Migrating MySQL hosts

1110 pts.
Tags:
Backup and restore
Host management
MySQL
MySQL backup
MySQL Database
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • NewnanIT
    [...] 10. One more chance to earn 100 knowledge points: Help one member out with migrating MySQL hosts. [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following