1,110 pts.
 Migrating MySQL hosts
We need to migrate a MySql database from one host to another. Will a simple backup and restore work? Are there references to the database inside itself? Will this work?

Software/Hardware used:
ASKED: October 7, 2010  7:20 PM
UPDATED: October 19, 2010  5:29 PM

Answer Wiki:
According to the <a href="http://dev.mysql.com/doc/refman/5.5/en/copying-databases.html">official documentation</a>: "The easiest (although not the fastest) way to move a database between two machines is to run the following commands on the machine on which the database is located: <pre>shell> mysqladmin -h 'other_hostname' create db_name shell> mysqldump db_name | mysql -h 'other_hostname' db_name</pre> If you want to copy a database from a remote machine over a slow network, you can use these commands: <pre>shell> mysqladmin create db_name shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_name</pre> You can also store the dump in a file, transfer the file to the target machine, and then load the file into the database there. For example, you can dump a database to a compressed file on the source machine like this: <pre>shell> mysqldump --quick db_name | gzip > db_name.gz</pre> Transfer the file containing the database contents to the target machine and run these commands there: <pre>shell> mysqladmin create db_name shell> gunzip < db_name.gz | mysql db_name</pre>" This blog post might be helpful as well: <a href="http://johnhesch.com/2007/01/31/moving-mysql-databases-to-a-new-server/">Moving MySQL Databases To A New Server</a>
Last Wiki Answer Submitted:  October 19, 2010  5:29 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _