0

I have a mysql db with many tables. I'm starting a new farm which should contain empty versions of the same database tables.

How can I efficiently create empty database based on existing one?

4 Answers 4

3

You need to dump the source database using the mysqldump -d option and then do a restore to the destination servers. Hope this helps.

5

Use mysqldump --no-data to dump the database schema but not the data and then restore that dump on your new database server. If you are using triggers or stored procedures you should include the respective parameters in your mysqldump call.

See 4.5.4. mysqldump — A Database Backup Program for details.

1

After you've made the dump, you can execute the SQL statements in your dump in the mysql client:

mysql> . dbdump.sql

If this is the same server, be sure to edit the dumpfile first to change the database name.

1
mysqldump -d database | ssh otherhost "mysql -Ddatabase"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .