Re: Database Duplication
| From: | Jason Wong | Date: | Tue, 30 Apr 2002 17:27:59 +0000 |
| Subject: | Re: Database Duplication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95401@lists.php.net to get a copy of this message | ||
On Wednesday 01 May 2002 01:04, Miguel Cruz wrote:
> 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
I would recommend adding the "--opt" option to the mysqldump command. These
will amongst other things, drop tables on the destination db if they already
exist ...
> and then when you're done:
>
> mysqladmin -u root drop temp_db
... and thus you can omit this and leave the temp_db in place ready for use
next time.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Witch! Witch! They'll burn ya!
-- Hag, "Tomorrow is Yesterday", stardate unknown
*/