Re: Database Duplication
| From: | Miguel Cruz | Date: | Tue, 30 Apr 2002 17:04:53 +0000 |
| Subject: | Re: Database Duplication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95400@lists.php.net to get a copy of this message | ||
On Tue, 30 Apr 2002, Liam Gibbs wrote:
>> Before starting a test, dump your database with the
>> mysqldump command.
>> Edit this file to create/use your test database.
>> Load your test database with this file.
>
> Hmm. No I didn't do this. Not too familiar with all
> the intricacies of MySQL (or SQL). I'll take a look at
> dumping the database.
Something like:
mysqladmin -u root create temp_db
mysql -u root -e 'grant all access on temp_db to real_user'
mysqldump -u real_user real_db | mysql -u real_user temp_db
and then when you're done:
mysqladmin -u root drop temp_db
obviously adding -p to those lines as appropriate.
But it's not going to be that fast with large databases, and you'll have
to work out some scheme for dealing with multiple users each needing their
own copy.
We don't know nearly enough about your project to really work out
alternatives for you, but I bet there's a good one somewhere. Temp tables,
shadow tables in the same database, something.
miguel