Mysql – Fast copy/rename database, not thesqldump

copyMySQLmysql-5.6

I would like to keep a "default" setup for a database on a testing server, which can be used to "restore" a "dirty" testing database back to the default state.

mysqldump is very fast, done in a few seconds. But restoring from the dump takes 5-10 minutes. If I could drop the test database, copy the "default" over to the test database directly somehow, perhaps by copying the database's system files, that would be awesome.

Best Answer

It sounds like you have a lot of indexes and/or you have not set innodb_buffer_pool_size is too small on your testing server. If you have "indexed every column", repent!

A way to get a full disk copy instantly, regardless of its size, is to use LVM. You would have the database sitting there, then you would take a "snapshot" and use the snapshot. Eventually would would toss the snapshot.