In the last two chapters, I talked about Installing WordPress Locally and Building Custom WordPress Theme. This chapter will cover exporting your local WordPress to a web host. Assume you are done with the local WordPress development, it is time to learn how to export and import WordPress. Then you can keep the local version for backup purpose and future development (ie. testing new themes, plugins, and upgrades).
1. Export Local Database
Login to your local phpMyAdmin, select the database from the dropdown. Click on the Export tab:
- Under the Export field, make sure all tables are selected
- Under the Structure field, tick "Add DROP TABLE / DROP VIEW"
- Tick "Save as File"
- Then click Go and it will prompt you to download a SQL file

2. Find & Replace All Local URLs
Open the database SQL file with a text editor. Find and replace all local URLs with your domain URL (eg. replace all "http://localhost:8888/mysite" with "http://www.yourdomain.com").

3. Import The Database
Login to your server cPanel, go to MySQL Databases, create a new database and assign a user. Now go to phpMyAdmin, select the database (the one that was just created) from the dropdown, click on the Import tab, browse the SQL file and click Go.

4. Upload WordPress
Upload the entire WordPress folder to your server.
5. Change The wp-config.php Setting
On your server, open the wp-config.php file. Change the database details to reflect your server settings.

6. Done
Go to your website and everything should work perfect.
Very useful tips.Thanks for sharing.
You know, searching and replacing the sql file is such a simple perfect idea – that I have never used. I hunt and peck through phpmyadmin to change the urls. This goes into the “Why didn’t I think of that!” file.
Thanks so much for sharing. Your posts are always worth a look, even when they focus on things that I think I know how to do…
Another informative article. I’m still not personally sold on WordPress but I do understand why it is so popular and I can appreciate its ease of use. Keep it up.
Thank you for sharing your knowledge, it’s highly appreciated.
Question tho – What kind of font are you using?
Thank you
I still think WordPress is the leading CMS for standard blogs, which is mostly down to its simplicity, wide spread support and plug-ins. There are others I like though such as MovableType, which handles multiple blogs very well. Anyway, thanks for the tutorial Nick. Very useful.
- CMHB.com
Great Tips
Thanks
get series on wordpress. Very helpful. Thanks!
I got lost right away, because in step #1 it calls to log into phpMyAdmin. The screen is totally different than the one shown. I am using PHP 5.2.6 and MySQL 5.0.51b.
Apparently the layout has changed considerably, making the first part of the instructions useless because there is nowhere to go once the tables have been selected.
There is no Structure field, to tick “Add DROP TABLE / DROP VIEW”. There is however a “Create new table on database wordpress” field that requires to be filled in along with “number of fields” before “Go” can be clicked.
So you see that I am unable to continue until that gets clarified for me. Would it be possible that the instructions be updated using the most current PHP and MySQL?
Thanks,
Ernie
Thanks, good stuff. I’m feeling a little WordPressed out though.
This actually is easier than it sounds.
I had so much troubles in do this in my blog, i almost quit!
I would like to know how to do the reverse: export my remote wp install to my local Mac to test out changes, etc, while not live to the world.
Hey Nick,
Great set of tutorials you’ve put together here… Absolutely love wordpress and all that it’s able to achieve.
Just one last step you might like to cover would be a tutorial on upgrading your version of wordpress?
I think this post would be very useful for any newbee or to be bloggers who would like to use the world’s best wordpress as their blogging platform.
This is very helpful and very useful as well.
Hi,
Not sure if this has been mentioned yet, but before importing your .sql file into PHPMyAdmin on the new site, you should search through it with your code editor and change all instances of ‘http://localhost:888/’ to ‘http://www.nameofyourdomain.com/’ so that any images etc. that reference your localhost environment reflect your live environment.
If you don’t do that, any images etc. in your content probably won’t appear because they refer to localhost and not your live URL.
Ah,
Stupid me, I didn’t read your tutorial properly! I see you’ve already mentioend about localhost!
wow what an awesome design!
Thanks Web Designer Wall !!!
http://www.swebstudio.com.br
Scrap my last comment about writing an article about upgrading your version of wordpress…
With the release of WordPress 2.7 it’s as simple as clicking a button :P
Thanks for this entry!
This actually is easier than it sounds.
my blog