MySQL Migrate to another server

kamranonline

Member
Sep 16, 2012
21
0
51
Newtowncenter
cPanel Access Level
Root Administrator
Hi,

I have a dedicated server with cPanel/WHM and more than 11Gb MYSQL Data stores on it.
So I want to migrate my MYSQL Data to another server, How could this possible ?

DATABASES + PRVILAGES

Also, All my users set localhost into their scripts so how could this possible to use another MYSQL Server without changing the scripts configuration and how could it possible to transfer all databases and privilages to another server ?

Thank you
 

vincentg

Well-Known Member
May 12, 2004
179
6
168
new york
Setup a remote server but you will have to copy each database one by one.

Best to do in shell using mysqldump and mysql to export and import

I will create another topic on Remote mysql server
 

ruzbehraja

Well-Known Member
May 19, 2011
392
11
68
cPanel Access Level
Root Administrator
One option is setting up replication.

The other option is as below:

Try this out at your own risk.

This was for migrating an entire server. I guess the data migration process will remain the same.

http://forums.cpanel.net/f5/upgrading-migrating-new-cpanel-server-293282.html#post1234792

I would like to reiterate for any new readers that the rsync part is solely at your risk. You need to know linux commands to perform some of the functions.
cPanel will NOT provide support for any damage caused by this method.

If you are not comfortable, then DONT try these steps.

Before you start, create backups.

.....
.....
.....
.....


Although I tried out replication, it worked successfully for a short while and then errors kept cropping up, causing the sync to stop.

I found that copying the WHOLE /var/lib/mysql folder was the most reliable method of transferring sql.
Do note that copying anything less than the WHOLE folder may cause databases to get corrupt.

BEFORE Syncing the databases, you need to ensure that the databases are locked and read only.

This can be achieved by going to the mysql console and typing:



Databases were synced with the command:


Note that in the above command I have not used the -u switch, since I felt that it was not updating the files properly, causing some databases to get corrupt.

To remove the lock and resume normal database operations you can use:


Keep doing these often, till the IP is switched.

Feedback welcome.