HostGator.com » Support Portal

How to transfer your wordpress blog from one host to another host

Backup your Wordpress database using phpMyAdmin

First thing first, make a backup of your database using phpMyAdmin.   Once you have successfully logged into phpMyAdmin (cPanel -> MySQL -> phpMyAdmin) , click on the name of the database which contains your wordpress blog. Then click on Export in the main navigation area, within the export screen you must complete the following steps:

  • click on ’select all’ and ‘SQL’ from the Export menu
  • select ‘add Drop Table’, ‘add Auto_Increment value’ and ‘enclosure table and field names with blackquotes’ from the Structure menu
  • select ‘Complete inserts’ and ‘Use hexadecimal for binary files’ from Data
  • you can leave all the other values at their defaults

Once all those settings are selected you simply click on ’save as file’, this will download a filenamed wordpress.sql to your desktop. And that is that. You have successfully backed up your database.

If you don’t have PHPmyadmin installed on your hosting account, you can use mySQLDump from a SSH terminal.

Download/Upload all your Wordpress files using FTP.

You will need to download ALL your files from your old host and upload them to your new host.  This includes files from your themes folder and plugins folder. Make sure you also download any folders which were referenced outside of your blog folder. For example I use a seperate folder called ‘images’ which is located outside of ‘blog’. If I didn’t copy and upload this folder to my new host I would have a lot of broken links to images within my blogpost. This is not a pretty sight.

The FTP client I use is Filezilla. By default Filezilla does not display your .htaccess file, probably for security reasons but I’m not too sure. To ensure that your .htaccess file is included in your download you must click on ‘View’ and then enable ‘Show Hidden Files’. If you neglect to upload your .htaccess file then your permalinks will get screwed up. That is of course if you are using permalinks.

Please note that you should not take this oppurtunity to update to a newer version of Wordpress. Your database may not sync’ as a result. Complete your migration before you consider upgrading.

Edit wp-config.php and create a new Wordpress database.

Okay, so we are nearly there. You must now edit wp-config.php to include the database settings of your new database.

Once you have edited the file with your new database settings, upload it to the root of your blog folder.

So now everything is set, expect that your new database does not contain any database tables.

Import your Wordpress blog to your new Database.

You can use either phpMyAdmin to import your database or you can use BigDump.  BigDump is the preferred option if you have a large database (10mbs or more). There is a step by step guide on how to use BigDump on their website.

Once you have logged in, you can choose between two methods to complete the import. You can click on ‘SQL’ and run a query or you can use the ‘Import’ link to upload your wordpress.sql file into your database. I recommend using the former as the query can take some time and can sometimes crash your browser. Using the import feature seems to be a lot less strenuous on the browser.


Article Comments

Charles Baldwin
This did not work exactly as noted. When I tried to import my database, I kept getting an error message. What I finally did was update my WP blog to the latest issue on my old server. Then I used Fantastico to install WP on my HG account. Once I set up a database and WP populated it, then I downloaded my old DB and site and then Imported the old DB into the new one. I then copied my files over onto the WP files on my HG account. I did not include the config.php file that I edited, nor did I include my .htaccess file. Everything works fine now.

mani
how to run an sql query? if we were that intelligent / knowledgeable, we would not have come here in the first place. So please take the time to explain things a bit.

HostGator
This entire article is written for phpMyAdmin users. There is a tab at the top called 'SQL', and clicking it allows you to run MySQL query statements.

If you do not already know this, then that is why we recommend using the Import tab instead.


If you have read our knowledge base and still have questions or need more information, please contact us via phone or live chat for immediate assistance.

Post Comment