How to copy a mysql database
0While there is no “copy database” function for mysql, there is a way to automate the process better than saving a bunch of SQL to a file, then uploading the file. Mysqldump offers a way to copy a database to another existing database on the same server or a remote server. The official documentation is here http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html , although their syntax doesn’t include the required username and password login syntax (if your database server requires a login, I hope).
Use the following on linux –
mysqldump nameofdatabase1 -u root -p | mysql –host=localhost -u root -p -C nameofdatabase2;
You’ll be prompted for the password and you’ll need to enter it twice. If your destination database is remote, then replace localhost with the IP address.
Hi I'm Nick Bartlett and thanks for visiting my blog. I'm not much of a writer; many of my posts are short and to the point while others are meant to be a reference for myself and other web developers.