How to move all MySQL databases to another server
How to move all MySQL databases to a new server in a few simple steps.
Let’s assume your original location of mysql is at /media/disk/…
Your new location of mysql is at /
You just need to synchronize two directories /etc/mysql and /var/lib/mysql/. Remember to stop mysql before doing this, and start it after synchronisation.
/etc/init.d/mysql stop
rsync -rav /media/disk/var/lib/mysql/* /var/lib/mysql/
rsync -rav /etc/mysql/* /etc/mysql/
/etc/init.d/mysql start
that’s all!
Related entries: