Thursday, June 28, 2012

How to quickly move MYSQL database from one system to another?

I had a requirement where I wanted to setup a small MySQL database (running on Linux) and once everything looks Ok, I wanted to move it to production. Here are the few steps process for migrating database (within Linux systems):

1) Both systems must be running MySQL (should not be stopped)

2) On target system, first create the empty database (I used MyPHP to create database).

3) Ran the following command (of course replaced the parameters like SOURCE-USERNAME etc to actual username.

# mysqldump -hlocalhost -u[source-user] -p[source-pwd] DB-NAME | mysql -h[dest-host] -u[dest-user] -p[dest-pwd] DEST-DB

Note: This method was tried on a Redhat Linux 6.x system and worked perfectly!!! :)

No comments: