How to migrate a MySQL database to Winhost

This article describes the tools, and steps needed to migrate an existing MySQL database or tables to your new MySQL database hosted at Winhost.
 
Requirements:
  1. MySQL information (MySQL server name, DB name, DB username, and DB password) to access your Winhost.com MySQL database.
  2. MySQL information (MySQL server name, DB name, DB username, and DB password) to access your current MySQL database.
  3. mysqldump.exe and mysql.exe command line utilities.
 
Obtaining and installing the MySQL utilities:
  1. Download the latest releases of MySQL for windows from one of the mirrors listed here.
  2. Unzip the install file to C:\ using your preferred unzip utility.
  3. The mysqldump utility will then be stored in C:\mysql-X.X.X\bin\.
 
Convention for names used below:
  1. Do not include the [ ]'s for values that surround by [ or ], these are just to illustrate where to plug in your specific information for those values.  For easier reading the values that need to be replaced are colored in red.
  2. Towards the end of some of the command line statements there are <'s or >'s by themselves.  These are not typos, they tell the command line to redirect STDIN or STDOUT to the command in front of them.
  3. Definitions of the values that need to be replaced with your personal information.  You can review your Winhost MySQL database in more detail with this knowledge base article.  How to manage MySQL databases
    • [hostname]: The server name or IP address of the MySQL server you want to connect to.
    • [user name]: The user name you use to access the mysql server you are connecting to.
    • [password]: The password you use to access the mysql server you are connecting to.
    • [database name]: The name of the database that your tables are stored.
    • [table name]: The name of the table you want to dump or import.
 
Note: The values presented above for your "current" MySQL database will vary depending on where the database is hosted etc.  If your current MySQL database is hosted with another company they should have provided you with the above information specific to your account with them.
 
Use the mysqldump utility to create a backup of your database:
  1. Open up a windows command prompt.
    • Click Start -> Run
    • Enter "cmd" into the dialog box and click the "OK" button.
  2. Go to the directory that the mysqldump utility is located.
    • cd C:\mysql-X.X.X\bin
  3. Create a dump of your current mysql database or table.
    • Run the mysqldump.exe program using the following arguments.
    • mysqldump.exe -e -n -u[user name] -p[password] -h[hostname] [database name] > C:\temp\[database name]-mysqldump.sql
  4. If you supplied all the arguments properly the program will connect to your current mysql server and create a dump of your whole database in the file you specified in your C:\temp directory.
 
Use the mysql client utility to import your database dump to a MySQL database:
  1. Open up a windows command prompt.
    • Click Start -> Run
    • Enter “cmd” into the dialog box and click the “OK” button.
  2. Go to the directory that the mysql client utility is located.
    • cd c:\mysql-X.X.X\bin
  3. Import the dump of your database or table.
    • Run the mysql.exe program using the following arguments.
    • mysql.exe -u[user name] -p[password] -h[hostname] [database name] < c:\temp\[database]-mysqldump.sql
In addition to backing up your site files, our SiteBackup service can also back up your databases. Now you can control backup retention and schedule. Automate your backups with SiteBackup.