websites migration

To migrate websites from one vps(vps1) to another(vps2), you should migrate both the website files and the databases that the websites use.

migrate website files

login vps2 and go to the home directory of your website(/home/admin/domainhostseotool/, if you use kloxo-mr).

scp -r -oport=vps1sshport -p root@vps1ipaddress:/home/admin/domainhostseotool/* . -r means copying all sub-directories, -p means reserving time and mode of original files.

chown -R admin *

chgrp -R admin *

migrate databases

There are two methods to migrate databases.

The safer one is using mysqldump to dump database from vps1 and use mysql to import to database on vps2. However, in my case, there is no disk space on vps1 to save the dumped sql file. Therefore, I have to copy the database files directly from vps1 to vps2.

Go to /var/lib/mysql on vps2, make directory for each database. Copy  /var/lib/mysql/ibdata1(innob database)  and all files in all database directories(innob and myisam database) on vps1 to the corresponding directories on vps2. Change the owner and group of all copied files to mysql and their mode to 660.

Posted in tips of hosting