This is Part two of our previous blog post, “How to Launch and Fashion and Lifestyle Blog using WordPress.org.” It is meant to cover users that want to migrate from one host to another.

In the world today, there are hundreds of thousands of WordPress hosts.  Every host has different pros and cons, and different features. Some are easy to work with, some are not. Some are running on very reliable hardware, while some others hum away in Mom’s basement.

From time to time, and for different reasons, you may come across the choice to switch hosts. Unfortunately, the process is not like changing cell phone brands. Today, I am going to break WordPress down into its constituent parts, so that you know how to bundle your blog up and bring it to a new host!

Table of Contents

  1. What exactly is the WordPress.org program?
  2. IT Lesson #1: PHP? Pre-hyper-what?
  3. IT Lesson #2: MySQL? My something something something? Database what?
  4. IT Lesson #3: Uploads. What about my pictures?
  5. OK, what now?
  6. Application-specific instructions: FileZilla (How to retrieve and upload your code and files)
  7. Application-specific instructions: PHPMyAdmin (How to export your database)
  8. vSysIO-specific hosting instructions: A simpler way to install your database

What exactly is the WordPress.org program?

WordPress is a program that runs on a server. It uses a programming language called “PHP” (or Pre-Hypertext Processing) to generate pages and content which are presented to users. It uses a database program called “MySQL” (or My Server Query Language) to store text-based content. Finally, it uses the filesystem of the server to store media, such as images and videos. Combining all three of these together, it creates the platform that we’ve all come to love and hate (hopefully, mostly love!).

IT Lesson #1: PHP? Pre-hyper-what?

Computers work strictly with 1s and 0s. As a big ol’ pile of ones and zeros is hardly possible to read by anyone, computer programmers needed an easier way to do their daily jobs.

Enter the programming language. A programming language translates “pseudo-english” into code the computer can understand and run.

For example, the following line of PHP code does a very simple job:

echo “Hello World!”;

This line of code prints “Hello World” to the webpage, and then exits. No pretty pictures, just an ugly “Hello World.”

Of course, the code used in WordPress is way more complex, and consists of hundreds of thousands of lines of code.

Where can I get my WordPress code?

PHP keeps its code in .php and .inc files. Most hosts have a file manager, or provide something called “FTP.” If you bundle all these files up, you have all the code for your WordPress site, and you can bring this to your new host 🙂

IT Lesson #2: MySQL? My Something Something Something? Database what ?

PHP on its own is very powerful. However, on its own it has one flaw: It cannot morph dynamically. You can’t update its code on the fly. With just PHP alone, to make or change an article on your site, you would need to directly edit a file on the server directly, which can be quite scary!

Enter the database. Enter MySQL.

A database is similar to an Excel spreadsheet. You have rows and columns of cells. In each cell, you can have a bit of data, for example, a name, an address, or the contents of a blog post. If you were using an Excel spreadsheet to store your website data, it would look like this:

excel

A database is like an Excel spreadsheet gone pro! However, Excel spreadsheets have one major limitation: Only one person can use it at a time. How do we solve that problem?

Enter MySQL.

MySQL, or “My Server Query Language,” is a database engine designed by Oracle. It allows us to store information, such as the owner, the date, the featured image, and other characteristics of data. It does not, however, allow us to store media such as photos and videos.

Being a computer program, MySQL also has its own machine language that websites and other applications use to communicate with it. Here’s an example of some of its language:

SELECT first_name,last_name,email_address,state
FROM customers
WHERE
state = “Oregon”;

This little bit of MySQL code asks the server a question. If worded in our English language, it would read as follows:

Provide me with the first name, last name and E-mail addresses of all users that live in the state of Oregon.

Of course, MySQL does not store its data in this manner. The way MySQL actually stores data is far outside of the scope of this article.

Where can I get my MySQL data?

Most hosts will have a way to export your database. Usually, you’re given a file with an extension of .sql (sometimes this is wrapped inside of a compressed .zip file). If your host doesn’t have this option, you should be able to download a backup of your site. Check this backup for that file, chances are, it’s in there!

(Note: Some hosts do not provide the ability for you to export your database. If this is the case, you may need to do something more exotic, such as installing a WordPress plugin that will do it for you!)

IT Lesson #3: Uploads. What about my pictures?

And, now we move onto the media. “Media” is anything that generally is not text or code. It can be photos, it can be videos, even PDF files that you download. The point is, any content that cannot be stored as code, or can’t fit in the database, has to sit as a file on the server, which is sent to your web browser on request.

With WordPress, finding your media is easy! It’s always stored in a directory called uploads. This directory is within a directory called wp-content. Some hosts will have your entire WordPress installed in a subdirectory.

For example, if you’re using my hosting, the path to your media would be as follows:

starting directory -> whatever-your-domain-is.com -> wp-content -> uploads

Some other hosts might have a different structure, such as:

starting directory -> wwwroot -> whatever-your-domain-is.com -> wp-content -> uploads

if you’re horribly lost in your hosts directory structure, look for a file called wp-config.php. This file is always located at the base of your WordPress. If you start at the directory where wp-config.php lives, and go to wp-content, and then uploads, you’ll be there.

Once you’ve located all these files (most likely in a structure that has year and date), you’ll want to download all of these files. Take note: The amount of data can be absolutely ENORMOUS. I’ve seen blogging sites grow up to 20 GB in size. Make sure your Internet connection is good!

OK, what now?

Now that our IT lesson is over, you need to do two things:

  1. Download your media, and code files. Most hosts provide a file manager, or something called “FTP,” as a way to access your files. Because code and media is stored within a common directory tree, you can download both in one go. Download all the files your host has, starting at the directory where wp-config.php lives.
    Note: If you have a Windows PC, read “Filezilla” below for FTP instructions.
  2. Export your MySQL database. Most hosts have an option to do this. Look for something on their control panel for exporting SQL, and use this. Ultimately, the goal is to download a file with an extension of .sql.
    Note: Instructions for “PHPMyAdmin” are below, as are instructions for a WordPress plugin if your host does not have this.

You should now have two things: an enormous pile of files, and a .sql file. You can now bring these files to your new host!

With your new host, you now need to do the following:

  1. Create a database. The instructions for this vary incredibly wildly among hosts, but for a demonstration of how to do this with my own hosting panel, look at “Import Database on vSysIO” below.
    Some hosts use a different username and password for each database. It is important to record the following details:
    Database host
    Database name
    Database username
    Database password
  2. Import .SQL file into new database. Now that you’ve created the bones, you need to add meat. Again, the instructions vary incredibly wildly among hosts. I will also do a demonstration of this process below.
  3. Upload code and media to your new host. An example process for doing this via FileZilla is listed below.
  4. Modify your WordPress configuration files. This step might seem scary, but really shouldn’t be! All you need to do is open your new hosts file manager, and modify wp-config.php to reflect the new database name, username and password. Look for the following lines, and make changes as necessary:
    wpconfig-1

    define(‘DB_NAME’, ‘wordpress_4’);
    define(‘DB_USER’, ‘wordpress_3’);
    define(‘DB_PASSWORD’, ‘4eS6wo#E0R’);
    define(‘DB_HOST’, ‘localhost:3306’);

    Change these details to reflect your new data. Ensure the new data is kept within the single quotes!
    So, for example, if your database name was bossbabe_db, your database username was bossbabe_user, password was awesomebossume, and database host was db1.superservers.com:3306, you’d replace it with the following:

    define(‘DB_NAME’, ‘bossbabe_db’);
    define(‘DB_USER’, ‘bossbabe_user’);
    define(‘DB_PASSWORD’, ‘awesomebossume’);
    define(‘DB_HOST’, ‘db1.superservers.com:3306’);

    Save the file, and you’re good to go!

  5. If possible, preview your migration! Some hosts (me included) have the option for you to preview the website without having to change your domain details.
  6. Change your Domain details (DNS). Since your site is now hosted on a new server, you need to change your www.website.com name to point to the new server. Chances are, you’re going to bail 100% on your present host, so you need to do this with your registrar (the company you registered your .com name with). Check with your registrar for instructions on how this process works.
  7. Wait at least an hour. Domain switches, once performed, can take a while to complete. In the worst case scenario, it can take up to 4 hours to complete; generally however, it’s done within an hour.
  8. Give it a go! If everything went according to plan, this should have worked, and you now have your site at a new host! Congratulations!

Application-specific instructions

FileZilla

FileZilla (Download: https://filezilla-project.org/) is an FTP, or “File Transfer Protocol” program. It allows you to connect to a server and download files. It’s available for Mac and PC. I’ll walk you through the process of downloading files from a server to your computer. I’m going to use our old friend Elizabeth Taylor as our example 🙂

  1. If not installed, install FileZilla from the link above. The instructions vary between operating systems, but is pretty much the same as any other program.
  2. Get some details from your host. This may be listed on your host’s control panel. You need the following deets:
    Hostname/IP address of the server.
    Username
    Password
    Port
  3. Load up FileZilla. You should see the following:
    filezilla-1
    The left side is your computer. The right side is the server. Let’s connect to a server!
  4. At the top left, enter in the information given to you by your host. For example, for our Elizabeth Taylor account on my hosting, we would put in the following:
    filezilla-2
  5. Click Quickconnect. You might get a popup like this:
    filezilla-3
    This is perfectly fine. Click OK to continue.
  6. The right “server” side should now populate with files:
    filezilla-4
  7. On the left “Your Computer” side, navigate to where you want to save your files. For the purposes of demonstration, I created a folder called “Elizabeth Taylor.”
  8. On the right side, look for your wp-config.php file. In this case, it’s in the httpdocs folder:
    filezilla-5
    This is the folder you want to start from.
  9. You now know where WordPress is installed.
  10. In this folder on the right side, select everything:
    filezilla-6
  11. Next, with everything on the right selected, drag it to the left side. FileZilla will now download the files to the folder on the left side. A lot of crazy stuff happens:
    filezilla-7
  12. You will be notified in one manner or another when the download completes. Note, this can take a long time, especially for huge sites! Ensure your computer does not automatically go to sleep during this period, or it will cancel the download. If you didn’t get notified, check the bottom panel: if it’s empty, the download is complete.

Congratulations, you’ve downloaded the code and media for your website!

When you set up with a new host, you can upload all of this stuff using the same method, but instead of dragging from right to left, you drag from left to right. Also, on the server side, ensure you’re putting the files in the right folder! Your new host can tell you more about which folder to put the files in.

PHPMyAdmin

A large number of hosts use a free web program called PHPMyAdmin to administer their MySQL database servers. We can use this thing to export the .sql file we need. It looks incredibly scary to use, but if you follow my directions, and don’t deviate, you should be alright.

  1. Following the instructions on your hosting control panel, log into PHPMyAdmin.
  2. You should be greeted by an incredibly scary looking interface that looks like this:
    pma-1
  3. Note, if your hosts PHPMyAdmin does not look like this, ABORT! ABORT! ABORT! You proceed at your own risk!
  4. First, at the top, click Export:
    pma-2
  5. Next, make sure “Format” is “SQL,” and click Go. A file is downloaded to your computer. Note that it can take a minute or two for PHPMyAdmin to generate the file, so only click once:
    pma-3
    Presto! The .SQL file we need!

You have now exported your WordPress database to a .SQL file. You can now send this to your host.

If your new host also uses PHPMyAdmin, the import instructions are essentially the same:

  1. Log into PHPMyAdmin using your hosts control panel.
  2. You should see our scary old friend again:
    pma-1
  3. Click “Import” at the top.
  4. You should now see this:
    pma-4
  5. Click “Choose File” and select the SQL file you previously exported.
  6. “Default” options should be fine.
  7. Scroll to the bottom, and click Go.
  8. It will do a bunch of crazy stuff. Note this can take a few minutes for PHPMyAdmin to process.
  9. You’ve now deployed your new database!

Alternative option: Migrate using a WordPress plugin

If your host does not provide the option to download a .SQL file, you can also try using a WordPress plugin. Be advised however, that this method is more prone to fail if you’re using a more uncommon host. If you’re on mainstream hosts like BlueHost, GoDaddy or WPEngine, you should be fine.

Unfortunately, the batch of WordPress database-only export plugins I tested were.. well… mostly crap and they all go against my recommendation. In particular, most of them only support specific hosting scenarios, which isn’t what we want: I want to give you the most compatible solution there is!

Therefore, if your host is this restrictive, we’ll have to go with an all-or-nothing choice: Using a plugin that exports everything, not just your database!