How to migrate your current MySQL database/tables to the DiscountASP.NET mysql server

This article describes the tools, and steps needed to migrate an existing MySQL database or tables to your new MySQL database hosted with DiscountASP.NET. This method involves installing MySQL in your development environment, and is suitable for larger databases.



For a smaller database you may be able to use a MySQL desktop client or a web-based application such as phpMyAdmin to export your current database and then import it on your DiscountASP.NET account.



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. Download the latest release of MySQL for windows from one of the mirrors listed here.
  2. 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.
  3. 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.
  4. 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 copy of your whole 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 copy 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 your DiscountASP.NET 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

Article ID: 240, Created On: 11/14/2008, Modified: 3/13/2014