davedev
davedev

Reputation: 105

Duplicate MYSQL Database Same Server Without Using mysqldump

I have a large database, "devDB" that I want to duplicate on the same server to become my live database, "liveDB". Can I make a duplicate without using mysqldump? Last time I used mysqldump it took a really long time. Seems like there could be a quicker way if its just a matter of copying the files. Can you create a new database and copy all the tables?

Upvotes: 1

Views: 2578

Answers (2)

Dina Kaiser
Dina Kaiser

Reputation: 476

Michael's answer above is a good idea if you want to put the newDB in the same MySQL instance as devDB. If you want to put liveDB on a separate Instance, you could use mysqldump to "pipe" the output directly into the "source" of liveDB, so that you could avoid Disk I/O. Also to improve performance, you could disable MySQL's binlog on the target DB while Inserting data.

Upvotes: 0

Michael
Michael

Reputation: 2867

If you don't want to use mysqldump, create you databases/schema,

and copy the tables from one DB to the other:

 CREATE TABLE `liveDB.sample_table` SELECT * FROM `devDB.sample_table`;

Upvotes: 4

Related Questions