Creating Duplicate MySQL Database


#1

I’ve done it once before and cannot find the command to do it.

I’m looking for a SQL command which will spit out the sql statements to
create an existing database. All its tables and everything. So I can
then take that code and create another database with a different name,
but which is basically a mirror image of the original, minus the data.

Thanks in advance,
Chris


#2

On 6/8/06, Chris removed_email_address@domain.invalid wrote:

I’ve done it once before and cannot find the command to do it.

I’m looking for a SQL command which will spit out the sql statements to
create an existing database. All its tables and everything. So I can
then take that code and create another database with a different name,
but which is basically a mirror image of the original, minus the data.

I believe you are looking for the mysqldump command. It isn’t sql but
it
outputs the sql to construct a database. (mysqldump -u=user -p=password
app_development)

Sean C.


#3

somehting along these lines:

mysqldump -u -p > backup.sql
mysql -u -p <new_database> < backup.sql