Quantcast
Channel: WPMU.orggodaddy | WPMU.org
Viewing all articles
Browse latest Browse all 7

Migrating WordPress to a New Server

$
0
0

Somehow, I have ended up with my WordPress installations scattered over three different hosting accounts. This has been bothering me for a while, as I’m paying for three separate hosting accounts and I only need to be paying for one. To start the process, and as a form of catharsis, I thought I’d write a tutorial about how to migrate from one host to another. That way I feel like I’m doing something useful while actually I’m doing something boring.

To start with, I want to move my sites from GoDaddy to HostGator (my other sites are on Coolhandle who are even more useless than GoDaddy but I’ve got to start somewhere).

Before you get started it’s a good idea to tell anyone who works on the site that you’re migrating it and they should not make any changes to it until the migration is complete.

1. Backup your Database

First of all make a backup of your database. If you’re working on GoDaddy or something similar you’ll find your MySQL DBs under Databases > MySQL

Click the database you want to back up and enter the login details. Make sure you change your database type to English (UTF-8) when you log in.

insert your database username and password

Tip: If you can’t remember your database password you’ll find it in your wp-config.php file

Click on your database.

select the database you want to migrate

At the top you’ll see a tab that says “Export” click here.

click the export tab

Now you’ll be presented with options of what you wish to back up. Make sure that all of your database tables are selected, along with SQL.

Under Structure, make sure that the following are selected:

  • Structure
  • Add DROP TABLE / VIEW / PROCEDURE / FUNCTION
  • Add IF NOT EXISTS
  • Add AUTO_INCREMENT’
  • Enclose table and field names with backquotes
structure settings ticked

Make sure the “Data” checkbox is ticked.

Ensure the main data option is checked

You should end up with something that looks a bit like this:

MySQL Settings

Select “Save as File” and then click “Go

Choose "none" for compression and click go

Your database will back up. It may take a few minutes, depending on the size of your database.

2. Create Your New Database

Now I’m going to hop over to Hostgator where I’ll create my new database.

Log in to CPanel (or Plesk) on your new host and look for where you can create a new MySQL database. In Hostgator it’s about 2/3rds of the way down the page. Click on “MySQL Databases”.

click on mySQL databases

Add the new database name.

create your new database, calling it whatever you like

Add a database user, or add an existing user to the database. I’m going to use one that I’ve already created.

add a new or existing user to your database

3. Import Your Site’s Database

Once you have created your user return to your CPanel homepage. Scroll down until you find phpMyAdmin.

click on PHPmyAdmin

Click on the database that you want to access.

select the correct database

Look for the import tab at the top bar.

click the import tab

Browse for the file you want to import. Leave the character set as utf-8.

browse to the correct file

Make sure the Format is set to SQL. Click “Go.”

Leave it to do its thing.

Once it’s ready it’ll let you know. Your database for your site now has a new home on your new host (which isn’t stupid GoDaddy – w00t!)

completed import

Tip: if you are using a host which allows outside access to your MySQL databases you can use a trick from Vladimir Prelovac to avoid any downtime to your site. Unfortunately, it’s not going to work with Hostgator.

4. Download your Site

Open up your favorite FTP program and navigate to your site. Download all of the files onto your computer. This might take a while – go make a cup of tea!

download your site using your favourite FTP program

Open up wp-config.php and update the MySQL details with your new database.

You will need to change the following:

  • Db_name
  • Db_user
  • Db_password
  • Db_host
New MyConfig file with edits to line 19, 22, 25, and 28

5. Upload Your Site

With your new wp-config.php details inserted you’re ready to upload your site onto your server. Using your FTP program drag and drop the files you want onto your server.

upload your site to your new host

6. Change Your Nameservers

Unless you have transferred your domain to your new hosting company, you’ll need to update your nameservers. This process can take anything from 2 hours to 48 hours.

Log into your Domain Manager. Select the site you want to edit and then click “Nameservers”

select the site you want to edit and the click "edit nameservers"

Click “Set Nameservers”.

click set nameservers

You will get your new nameservers from your new host. When I signed up with Hostgator they came with the account info email.

add your nameservers

Wait!

My site took about 10 minutes to transfer the nameservers – so you might be lucky! You can do a Whois lookup on DNS Stuff to see if your nameservers have moved.

whois lookup showing new nameservers

And that’s it – your site is moved to your new host. Easy! Now I’ve only got another few dozen to do….

It gets a lot more complicated if you want to change your site’s domain. Want me to cover that too? Let me know in the comments – otherwise check out the WordPress Codex!

Related posts:

  1. How to Find the Hostname of Your Database Server When Installing WordPress The database hostname value is unique to your hosting company....
  2. Running SQL code on your WPMU database Taken from: The WordPress MU Manual Occasionally you will install...
  3. The Lazy Man’s WordPress Server Diagnosis Tool The Diagnosis plugin adds subpages to the Dashboard menu with...

Viewing all articles
Browse latest Browse all 7

Trending Articles