For the past two years, my WordPress site has been in a constant state of migration. Recently, a fellow blogger initiated a group effort to co-rent a VPS provided by Virpus, costing $7 per month with 25GB of space, 100M bandwidth, and 1600GB of traffic. Divided into 10 shares, and thanks to a promotional period, each person pays approximately $7.5 per year.
The previous host was located in the Netherlands/Portugal, using the DA panel, and I still have one WordPress site hosted there. The new host uses the Kloxo panel, and both databases are MySQL 5.x (though 4.x would work just as well).
Due to frequent packet loss on my campus network, I have no choice but to perform all operations online. Fortunately, online methods are inherently simple and convenient.
1. Tools Preparation:
The tools you might need include Putty and CuteFTP (if you prefer that method).
Putty is a free SSH and Telnet tool.
Download Link: Putty
Go to the backend of your original website and choose to back up the entire site (usually labeled as “Create Backup” in English). Wait a moment, and then you can check the file management system. Since DA defaults to saving the backup tar.gz file in the backup folder under the root directory, you need to move or copy it to the directory of your original website. For example, I moved the xxx.tar.gz file to faxue.info/wordpress/uploads/. The reason for doing this is to give the xxx.tar.gz a legitimate download URL.
2. Using Putty to Download the Website Backup to the New Host
Open Putty, enter the IP address of the new host directly, select “SSH” mode, and click “Open” or press Enter to enter a DOS-like interface.
login as: admin (enter the username of the new host)
admin@208.89.212.251’s password: abc123 (enter the password of the new host; note that the password will not be displayed as you type, just press Enter after typing)
If the following content is displayed, you have successfully logged in:
login as: admin admin@208.89.212.251’s password:
Last login: Tue Jul 27 12:03:06 2010 from 61.142.209.146
[admine@vip ~]$
Type “ls” to open the root directory, or use “cd admin.tk” to enter a folder.
Then use the “wget” command to download the previously backed-up xxx.tar.gz to the new host:
A 120MB file, compressed to about 40MB, should download in just a few seconds…
After downloading, please delete the backup file from the original host, as it contains sensitive information like config.php, which others could access.
3. Extract the Files
Use the file manager to move xxx.tar.gz to a folder and extract it. Then, it’s just a matter of copying and pasting to arrange the files on the new host according to the directory structure of the original host.
4. Upload the SQL File
After extraction, locate the backed-up database file, usually in the backup folder. Identify the database name, for example, mine is faxue_blog.sql. Use the “mysql” command to upload the database file:
First, use the “cd” command in Putty to navigate to the folder where faxue_blog.sql is located,
cd faxue.info/domain/public_html/backup
Then use the following command to upload the database:
mysql -ufaxue –pabc123 faxue_blog < faxue_blog.sql
The format is: mysql -uusername -ppassword database_name < database_file_name.sql
Of course, the username and password here are for the new database. It’s recommended to create a database with the same name as the original on the new host beforehand to avoid modifying config.php later. However, if the username on the original host differs from the new one, you’ll still need to update config.php.
At this point, the main issues are resolved. Just modify the A record, and you’re done.
The following are personal issues that may not apply to everyone:
My original host had N subdomains bound, with N programs installed, including WordPress, Joomla, Drupal, Gregarius, etc., all using the same database but with different prefixes. Using the above method, it’s easy to migrate all the data from the previous site. Of course, with multiple databases, the final upload step will need to be repeated several times.
The database username on the original host was different from the new host’s database username. The previous ones were bensky_, while the new ones are faxue_. Therefore, all websites and sub-sites need to update the database information in their config files after uploading. However, the table name prefixes in the database do not need to be changed, as they remain consistent.
Encountering Vistapanel was a major setback for me. Since Vistapanel only allows extraction and not compression, and does not support FXP, I couldn’t back up my sites on byethost.com and xtreemhost.com (the only method would be to download all files from these hosts to my local machine and then upload them, which I didn’t have the patience for). So, they remain hosted there for now.