views:

67

answers:

3

Is it posible to duplicate an entire MySQL database on a linux server?

I know I can use export and import but the original database is >25MB so that's not ideal.

Is it possible using mysqldump or by directly duplicates the database files?

+2  A: 

I sometimes do a mysqldump and pipe the output into another mysql command to import it into a different database.

mysqldump --add-drop-table -u wordpress -p wordpress | mysql -u wordpress -p wordpress_backup
Paul Tomblin
+1  A: 

To remote server

mysqldump mydbname | ssh host2 "mysql mydbcopy"

To local server

mysqldump mydbname | mysql mydbcopy
Peter Lindqvist
+1  A: 

First create the duplicate database:

CREATE DATABASE duplicateddb;

Make sure the permissions etc are all in place and:

 mysqldump -u admin -p originaldb | mysql -u backup -p password duplicateddb;
Vincent Ramdhanie
Worked great thanks
Adam Dempsey