Move a WordPress Site by Moving the Database

Move a WordPress Site by Moving the Database

Step 1) Back Up the Database

WordPress store information in the MySQL database. It is necessary to transfer this database to relocate the website in the first place, which is perhaps the most challenging component. You’ll have to back up your database from the old site before you do this.

Method 1 Use a Plugin

There is a way of backing up your database with an application plugin. Make sure that you’re dealing with a huge database (say more than 50 MB) it is better applying the second method.

WordPress offers a variety of plugins to backup the database. My preferred is a plugin called wp-db backup. After the plugin has been installed and activated, click Options > Backup in the administrator.

The plugin will search for tables that are not in this database. These tables are not “core” WordPress tables may be from plugins that you’ve installed, which stored information within them.

Select if you wish to have the backup file delivered to you via email or directly downloaded and then click on the “Backup Now!” button.

Method 2 Use the Command Line

We’ll be a little closer to the ground by using SSH. SSH (Secure Shell) is a protocol for networks which allows you to secure connect to your server using an encrypted connections.

The first step is for you to be able to access the server. It is necessary to know your server’s IP as well as username, password, and password. Additionally, you’ll require a command-line client such as Terminal to Mac as well as Putty for Windows.

$ SSH username@[server-ip[server-ip

If this will be the first time you’ve established connection, you will receive an alert Are you certain you would like to connect again? Type yes and then press return. After that, you’ll be required to input the SSH username and password. Then you’ll connect to the server via SSH.

You can now export your database by using this procedure.

$ mysqldump -u [username] -p [database_name] > [name_your_backup_file].sql

You’ll have to replace the options listed in [brackets] with your personal information. The username doesn’t match that you use for the username you use for your SSH password, rather it’s actually your MySQL login username. The database’s name will find in the `wp_config.phpfile, if you’ve lost your. The system will also ask for a password upon this command. This is the password for your database that you can find in the `wp-config.php file.

The command will create a file (which you name in the end of the command) that will be an all-inclusive copy of the database. It is possible to point yourself to a suitable directory to execute the command, so that it can create the file there. Put the file’s path inside the command.

You’ll need an offline copy of the database.sql backup files. The best way to do this is to connect via FTP to the server, browse to where it was discarded and then transfer it to the location you dumped it. If you’re already using the command line already shut down your SSH connection and then use your SCP function to download it. Somewhat like:

$ scp [username]@[server-ip]:[backup_file].sql .

Step 2) Backup Files

It is now time to restore your original data from the server that was previously used. The theme files, plugins and the uploads… Everything. Also, your WordPress base files, but this is a good moment as any to download a new version of them for the new server.

In order to download your entire file from your old host, you can use an FTP client such as Filezilla in order to login to your server. You can either download all your files from the web root or only the wp-content folder if you’re planning to install a new version of WordPress on your newly installed server.

It may take a while! There’s likely to be quite a number of images and files.

Step 3) Move the Files to the New Server

You can now log in to your newly created server, as well as through FTP to transfer these files onto the root of the web folder you downloaded from the previous server. It could take a while (uploading is typically a bit more slow as compared to downloading).

Step 4) Import the Database to the New Server

In this step, you’ll transfer the database onto the server. This step can be done using two options: either via PHP myAdmin, or via SSH.

Method 1 via Control Panel

The majority of web hosts have some kind of control panel which allows access to databases for example. It could be cPanel. It could be Plesk. It could be a special item.

You’ll probably make use of your control panel in order to make the database that you want to use on the new server. It’s likely that the control panel will grant access to a program called phpMyAdmin it’s specifically designed for managing MySQL on the internet.

Log into the new database to access the new website.

The real moment: import of backup `.sqlfile from the old website!

Click on the the import tab at the top of the navigation.

Then, you can choose the `.sqlthe file on your computer local to you and open this file (press the Go button).

Method 2 via SSH

In the event that your database is big, as with exporting, you could SSH into the server and perform the import there. The first step is to upload the export of your database to the new server, and then connect via SSH to it (instructions on this in a earlier section) and then execute the command below to perform the import:

$ mysql -p [username][database_name] [database_name].sql

The username refers to the MySQL user and not the SSH user.

You may also have to modify some choices

If you’re changing the address of your site simultaneously with changing servers, you may require some extra MySQL work. For instance, if you’re switching between to You’ll need to modify the URL of your site as well as the your home options on the table wp_options.

It won’t affect references that are hard-coded to in posts however (e.g. image sources). If you’re looking to alter this too, there’s an SQL that you can reference in the article on changing WordPress into HTTPS that might be useful.


Leave a Reply