Migrating Your Current MySQL Database/Tables to a DiscountASP.NET MySQL Server

This article describes the tools and steps necessary to migrate an existing MySQL database or tables to a new MySQL database hosted with DiscountASP.NET.

Requirements

  • Login and password to access your DiscountASP.NET mysql database.
  • Login and password to access your current mysql database.
  • mysqldump.exe and mysql.exe command line utilities.

Obtaining and installing the MySQL utilities:

  1. Download the latest release 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.
    • [hostname]: The hostname or IP address of the MySQL server you want to connect to, e.g. the hostname of your DiscountASP.NET MySQL server will be something like "mysql01.discountasp.net".
    • [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 in, e.g. Your DiscountASP.NET database name will be something like "MYSQLDB_1420".
    • [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 argument 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 mysqldump utility to create a backup of a table in 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 -u[user name] -p[password] -h[hostname] [database name] [table name] > c:\temp\[database name]-mysqldump.sql
  4. If you supplied all the argument properly the program will connect to your current MySQL server and create a dump of the table from your database in the file you specified in your c:\temp directory.

Use the mysql client utility to import your database/table(s) 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/table name] -mysqldump.sql

Did you know that our Website Cloud Backup service can also back up your database?  You have full control over backup retention and schedule. Automate your backups now with Website Cloud Backup.