Moving WordPress from localhost to your host

 

You have developed a site using a WordPress installation on your local computer and now want to move it to your own domain space? This is a question that pops up a lot on the internet, while in reality it is not that hard to do. Moving WordPress just takes a few steps…

Step 1. Export the database

If your provider has something like PhpMyAdmin just simply login and select Export. The export format should be .sql

In mySQL:

1
mysqldump -uroot -p -d wordpress > wordpress.sql

-d is the database name you want to export. -u the user and include -p for the password prompt.

Step 2. Change the site values

WordPress stores the path of files in the database. This means that everything will point to localhost. We have to make this point to your new site. Open the SQL file with a standard editor like Notepad++, Nano, Vim – ( It may take a while ). Do a search and replace, searching for your local path (mine is localhost/wordpress ) en replace that with your new site ( mine weblogmechanic.com ). Wait until it’s done and save it.

Step 3. Import the database

In PHPMyAdmin select a database ( create one if there are none ) and hit ‘import’. Point to your new .sql file and everything will be imported.

Or using Mysql:

1
mysql -uroot -p -D wordpress < wordpress.sql

Step 4. Copy the files

Copy the installation on your local computer to the server. This should be pretty easy with FTP.

Step 5. Change wp-config.php

Don’t forget to update your wp-config settings like database name, login etc.

Done!

If everything went well you just moved your site! You can use this instructions as well for moving between one location to another. The steps should be about the same!

Tags: , , , , ,


Bas Schuiling

Bas Schuiling

Expert on everything web development and WordPress. Is pressing his words when version 1 came out and has been liking it ever since. More than 10 years of work experience in web development and writer of this blog.