Cormac Moylan

Hi, my name is Cormac and this is my blog. On the web circa July 2006.

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

March 4th, 2007 by Cormac Moylan · 37 Comments

I always get nervous whenever I need to transfer files. I get really nervous when that transfer involves a database. When you’re transfering files which are tied to a database you must ensure that everything syncs’ up properly on the other end.

I recently migrated my Wordpress blog from EuroVPS to Blacknight, while keeping the same domain name. I’m going to run thru the steps and areas that you should be aware of when you’re migrating your own blog.

Blacknight - Hosting and Domain Names Ireland

Backup your Wordpress database using phpMyAdmin

First thing first, make a backup of your database using phpMyAdmin. phpMyAdmin is the most popular and common interface for accessing your database via a webpage. Generally you can access phpMyAdmin by navigating to yourdomain.com/phpmyadmin, but if this results in a ‘page can not be found error’ then you will need to either login to your admin panel, to find the correct path to phpMyAdmin, or contact your webhost for further assistance. Once you have successfully logged into 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.

One thing to be wary of is Charset values.

Charset differences within mySQL databases can throw a spanner in the works for many migrations. The default charset for Wordpress is Latin1. When you’re exporting/importing your sql file you must ensure that you’re using Latin1 or that you’re using the same charset value between your old database and your new database. If use conflicting charsets you may encounter compatability issues with characters within your database. To check which charset you’re using you can check the column named Collation within phpMyAdmin or when you have completed your backup you can view the contents of the .sql file. Search for a file named ENGINE=MyISAM DEFAULT CHARSET=latin1.

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 config.php and create a new Wordpress database.

Okay, so we are nearly there. You must now edit config.php to include the database settings of your new database. I’m going to presume you know how to setup a database :)

The majority of decent webhosts have tutorials on their site on how to use their hosting control panels. Blacknight have a video tutorial which illustrates how to create a mySQL datbase in DirectAdmin. If you are any bit unsure about how to create a database then you should contact your hosts support for further information.

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.

I’m going to use phpMyAdmin to import my database as it is less than 10mbs in size. 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.

That’s all Folks!

The migartion of your Wordpress blog from one host to another host is complete. If you encounter any difficulties with your migration you should pop over to the Wordpress Support Forum for some assistance. You can also post a comment here if you have any questions about migrating hosts. I’m more than willing to help.
Wordpress

A plugin which you may find usefull is IL Filosofo’s Wordpress Backup plugin. I haven’t used this plugin as I don’t see the need to. Once you know your way around phpMyAdmin you can complete your own backups without the need for a plugin. I recommend you to keep regular backups of your database. AutomySQLbackup is a SourceForge project which backs up your database and emails you the backup in a compressed format. Very handy tool to have in your arsenal.

Bookmark:
  • BlinkList
  • del.icio.us
  • Digg
  • Facebook
  • Google
  • StumbleUpon
  • Technorati

If you're new here, you may want to subscribe to my RSS feed. Thank you for visiting! Cormac

Tags: Hosting and Domains · Linux · Software · Wordpress & Blogs

37 responses so far ↓

  • 1 amitabhjotwani.com » Blog Archive » Transferring wordpress site // Apr 14, 2007 at 11:35 pm

    [...] You can find more detailed instructions here [...]

  • 2 Arshad Merali // Apr 17, 2007 at 4:16 am

    I just used this process to switch over to a new host and it worked fine… a few small things like the fact that the SQL backup contains info from the old server like DB name and User name (I think) so I had to manually change those prior to importing the SQL in to PHPMyAdmin since the info was different on the new server.

    Thanks for putting this up…. it really helped me make the move and I couldn’t have done it without.

  • 3 Cormac Moylan // Apr 17, 2007 at 7:08 am

    Thank you Arshad, glad to be of service :)

    It’s a bit odd that the database contains the database name and username as data. I must check that out.

    Cormac

  • 4 Alan // Apr 17, 2007 at 8:40 pm

    I also just used the instructions here Cormac and found them very very helpful in the transfer of a WP blog of a friend - better than the Wordpress instructions, which I tried to follow as a test on my own blog - but made an arse of.

    Just one thing I found with the successful transfer was that weird characters are appearing in the posts now - like this –> Â - they seem to pop up randomly. I guess it’s something to do with the charset issue you mentioned but I don’t know if there is a way to fix something like this

  • 5 Cormac Moylan // Apr 17, 2007 at 9:19 pm

    Alan, that’s the charset causing that problem alright.

    If you take a look within the original .sql file it should indicate what charset was used. Simply setup your database using the same charset. That should resolve the problem.

    Cormac

  • 6 Alan // Apr 17, 2007 at 10:53 pm

    Cormac, Just took a look at the .sql file and looks like the weird characters are in there to begin with - so I’m going to try a new backup and go from there.

  • 7 Stuart Bell // Apr 21, 2007 at 9:20 pm

    Fantastically useful page — thanks so much for making my life significantly easier!

  • 8 Cormac Moylan // Apr 21, 2007 at 9:29 pm

    No problem at all Stuart. Thanks for the kind words.

    Cormac

    Alan, how did you get on in the end? If you’re still having problems I can take a look at your sql file if you wish?

  • 9 Transferring a wordpress site | 21digital.com // Apr 30, 2007 at 2:43 am

    [...] You can find more detailed instructions here [...]

  • 10 Bob Blick // Jun 6, 2007 at 6:33 pm

    Thank you!!! I was afraid of doing this but I gave it a try as I had to get out of a bad hosting situation. This worked perfectly!

    Follow the instructions he gives and follow them closely - it will work.

  • 11 Cormac Moylan // Jun 6, 2007 at 7:28 pm

    Glad to hear everything went well Bob.
    :)

  • 12 Alan // Jun 6, 2007 at 10:32 pm

    Never saw the comment back in April about how I’d got on in the end. As it happens I didn’t get a chance to re-do the backup as the hosting account where the backup was located had expired (friend was moving to a new host) - so she had to go in manually to all the posts and remove the stray characters - so I never willl know for sure if I had done something wrong at the backup stage!

  • 13 Hamant Keval // Aug 2, 2007 at 2:37 pm

    Hi - Came across your site - and looks like I may find the answer here

    I have a wordpress blog on my own domain

    Is there any way of duplicating all the settings and the plug ins to recreate another blog on another domain?

    Thanks
    Hamant

  • 14 Cormac Moylan // Aug 2, 2007 at 5:37 pm

    Sure,
    Just download all your wordpress files (including plugins), export your .sql file, setup a new database on your new domain, import your sql data, upload your files to the new domain and modify your config.php file so that it reads the new database instead of the old one.

    I covered pretty much all those steps in my above post.

    Why are you duplicating your wordpress blog? If you do this you get penalised by Google for having dulplicated content.

  • 15 Hamant Keval // Aug 2, 2007 at 10:12 pm

    Hi - I knew when I landed on here - I would get a real good answer.
    Thanks - Your help mch appreciated Cormac.

    Actually I am not wanting to duplicate the content - Its a complete new niche
    What I did not want to do was to go through and add all the plug ins that I have added over time and as I learnt more I configured all the settings to how I wanted and for seo.

    So If I follow your instructions as above - anything I need to leave alone if I am not wanting the content ?

    Hamant

  • 16 Cormac Moylan // Aug 2, 2007 at 10:19 pm

    Mmm,
    I’m not sure it will work that way Hamant.

    Some of the plugins you have installed may have added tables to your database for example. This may prevent you from removing the content from your database and just using a ’shell’.

    I suppose there is only one way to find out thought :)

    I would personally install a brand new blog and install my favorite plugins one by one to ensure that I’m as up to date as possible.

    Cormac

  • 17 Alan // Aug 2, 2007 at 10:24 pm

    Hamant, check out wpzipper - it allows you to create a complete package for your WP install which might be preferable to the way you are going about it now.

    http://www.wpzipper.com

  • 18 Cormac Moylan // Aug 2, 2007 at 10:35 pm

    Alan,
    That looks savage. Cheers for the link. I must remember to try that out next time I’m moving blogs around the place.

    Cheers.

  • 19 Hamant Keval // Aug 3, 2007 at 12:05 am

    Hi Cormac and Alan - much appreciated - Looks like a cool site . Night just save me some time that .
    I’me going to give it a go and see what happens.

    At the end of the day like you said - We can only try it. Nothing ventured nothing gained.

    Thanks guys , you were great help
    Best wishes -
    Take care
    Hamant
    I will pop in here time to time now

  • 20 Videos @ 2twit.com » Moving A Wordpress Blog // Aug 10, 2007 at 4:08 pm

    [...] I have successfully moved this Wordpress blog from one host to another. I am putting these instructions here for future reference for my other blogs. Full credit goes to Cormac Moylan as I got these instructions from him verbatim. They worked like a Charm. You may find them here directly @ http://cormacmoylan.com/blog/software/how-to-transfer-your-wordpress-blog-from-one-host-to-another-h... [...]

  • 21 Aqeel Syed // Nov 9, 2007 at 7:44 am

    I’m just going to try it, looks like this tutorial will help me. I will get back with an update soon.

    Thanks for putting this valuable information for not so ’savvy’ users.

  • 22 Cormac Moylan // Nov 9, 2007 at 9:52 am

    No problem Aqeel. Glad to help. Let me know if you encounter any difficulties.

    Cormac

  • 23 sampath // Nov 26, 2007 at 8:42 am

    Dear Cormac Moylan,
    I have just followed your steps to transfer Mysql database from one host to another. But there’s an issue regarding this. i.e. In my old account when i checked in CPanel, my old account Mysql disk space is 1.61 Mbytes but After transferring it to new host now in new host its showing only 1.31 Mbytes Mysql diskspace. Also some of the uploaded files in the site are missing in my site. Please tell me ur suggestions reg this issue. I am deeply confused over this , what might could be the problem???

  • 24 Cormac Moylan // Nov 26, 2007 at 9:59 am

    Hi Sampath,
    I think you may be using the incorrect charset when you export your db. I can’t think of any other reason why your db may be smaller than before. With regards to the missing files from the site, you’re going to have to double check that you downloaded them all.

    If you have more concerns about either your db or your files you should contact your webhost. Hopefully they’ll be able to help you further.

  • 25 Clive // Dec 17, 2007 at 7:09 pm

    Hi, this info is much appreciated.

    As I want to turn static web sites into blogs yet leave the original site there while building the blog i.e. my host remains the same is this easier?

    For example: http://www.mysite.com

    I then set up: http://www.mysite.com/blog

    After a few weeks, once the blogs nice and busy I want to replace the original site with the blog i.e. http://www.mysite.com is now the blog.

    I’d appreciate your input into effecting that as it’s something I’d like to do for a couple of my static, boring old sites.

    I reckon once a few of your readers see that it’s possible they’d consider it too.

    Cheers

  • 26 Cormac Moylan // Dec 17, 2007 at 8:51 pm

    Hi Clive, there are a number of ways to do this.

    You could design the blog to look like the main page.

    You could use the RSS feed from the blog to put the blog content on the homepage.

    You could create a modrewrite() to show /blog at the root. More info here > http://wordpress.org/search/rewrite

    You could use your blog to gather traffic and then 301 redirect all the pages to the root.

    This last option is probably the best for your needs. Backup your current site. Install a blog in the root (www.site.com). Then find all the currently indexed content in Google/Yahoo/MSN and redirect those pages to static pages on your blog.

    If you wish, I can write a blog post about this explaining it better?

    Cormac

  • 27 Clive // Dec 18, 2007 at 10:03 am

    Hi Cormac,

    Thanks for that. I’m not sure what is the best option as a couple you mention don’t apply (to me) as…..

    My main criteria for effecting the change is for SEO purposes and to be honest the design of the original static site is well out of date and will eventually go to the rubbish bin

    Hence new blog, new look BUT not losing current Adsense revenue from the current site while the new blog is being built.

    Maybe a new post by you on this, as you suggest, as I think this could be a new subject in itself as it would apply to anyone who’s set up a blog in a folder http://www.theirdomain.com/blog and now find that it’s more popular than their original site.

  • 28 eric // Mar 20, 2008 at 1:15 am

    hi,
    i’m porting a wp blog from one host to the other. i followed your instruction. but when i type http://www.mysite.com/blog, the browser gives me a window saying “open” or “save” as though i’m trying to download a file, instead of opening up my blog page. i’d appreciate very much if you can help point out the right solution.
    thanks,
    eric

  • 29 Cormac Moylan // Mar 20, 2008 at 1:23 am

    Hi Eric,
    It sounds like PHP isn’t enabled on your host account. You should probably check this with your web host.

  • 30 eric // Mar 21, 2008 at 3:58 pm

    cormac,
    thanks so much for your help. i got another issue. do you know why the following error message?
    ); add_action(’activate_’ . $file, $function); } function register_deactivation_hook($file, $function) { $file = plugin_basename($file); add_action(’deactivate_’ . $file, $function); } function plugin_basename($file) { $file = preg_replace(’|\\\\+|’, ‘\\\\’, $file); $file = preg_replace(’/^.*wp-content[\\\\\/]plugins[\\\\\/]/’, ”, $file); return $file; } function get_num_queries() { global $wpdb; return $wpdb->num_queries; } ?>
    Fatal error: Call to undefined function add_filter() in /home/mysite/public_html/blog/wp-includes/default-filters.php on line 4

  • 31 The Way I Transfer My WordPress Blog To Another Host | { thou shall blog } // Apr 27, 2008 at 8:34 pm

    [...] If you’re new here, you may want to subscribe to my RSS feed. Thanks for visiting!OMG! I did it. I was very nervous in the beginning as this was the first time I attempted to transfer this blog which was hosted in another subdomain to a brand new current domain and a new host. I did google to find the guide to do the transfer but none really convinced me to D-I-Y except one Cormac Morlan’s How to transfer your WordPress blog from one host to another host. [...]

  • 32 Yan // Apr 27, 2008 at 8:49 pm

    I am dropping by just after I finish the migration and writing the post about it. Thanks for the guide.

  • 33 Dexter // Jul 13, 2008 at 3:52 am

    Hey Cormack! Thanks for these wonderful tips! I used em and it was a success! One thing though, it seemed that my users /subscribers list weren’t transferred to the new wordpress host. Is there a workaround for this? Thanks man, hope to hear from you soon.

  • 34 Cormac Moylan // Jul 14, 2008 at 11:54 am

    I can’t see how that would interfere with your users / subscribers list if you were just moving web hosts. If you moved domains then you have to alter your subscription settings.

    I presume you talking about RSS here?

  • 35 How I customized my Wordpress Blog Part 2 - Fused Network and Media Temple. | Andrew Kelsall | Graphic Designer | Poster and Leaflet Design // Aug 4, 2008 at 10:46 pm

    [...] is second-to-none. When I was moving my sites to them, they gave me advice on what to do with transferring my other blogs’ database, as well as transferring all my domain names and their registry information/servers. I hadn’t [...]

  • 36 vlad // Aug 13, 2008 at 12:33 pm

    We just did this move but our plugins died.

    Well it reads the plugin folder from the old server rather then the new one.

    Any thoughts?

    V

  • 37 Cormac Moylan // Aug 13, 2008 at 1:39 pm

    Hi Vlad,
    That’s a strange one. I haven’t heard of that happening before. In your Wordpress Admin panel for General Settings are your “Wordpress Address” and “Blog Address” pointing to your domain or are they pointing to the IP address of your domain?

    That’s the only thing I can think of that might be causing an issue. I also see that your images are not been displayed on your site too. Your permalinks aren’t working either. I’m guessing too that your htaccess file is either missing or maybe it doesn’t have the right permissions set to it.

Leave a Comment