In simple words, installing WordPress on localhost means installing WordPress on a pc or mac. But…it will be only view able by you or your team.
Normally you would only install WordPress locally for testing and development purposes.
Make an offline website and once you are happy, you will be able to copy this offline website to your live website.
That’s the main purpose of installing Wamp and using it.
Installing WordPress locally on Windows is always preferable than working on a live website directly because working offline on localhost will be much quicker and you will save your bandwidth. Also see what is a localhost
STEP 1: Installing Wamp Server
WampServer will basically set up a web development environment on Windows machines so that you can easily develop dynamic applications. But obviously we are going to use it for WordPress.
It will install Apache web server, PHP and MySQL with a simple one-click install.
- Download WampServer first. (It’s a free software)
- Double click the downloaded file to start installation.
- Once installed, Wampserver shortcut will be created on your desktop.
- Double click the shortcut to run Wampserver. You may get a warning about running wampmanager.exe, simply click Yes.
- A tiny Wampserver icon will appear in Windows taskbar which will turn green which means you are all set to go.
- Click the top most option Localhost. It will show the localhost main page in your browser which means localhost is running perfectly. It will also give you information about which version of Apache, PHP are running on your system.
We are done with our Wampserver installation. Wampserver default location is c drive and folder name wamp64. Give a visit to this folder. Under this main folder, the folder most important to us is www folder. We will talk on this later.
Now is the time to start our WordPress love. As you may already know WordPress depends upon database and only after then we can start our WordPress localhost installation.
Basically installing WordPress either on a localhost or on a live website, it will always be a 3-step process:
- Creating a database for WordPress
- Copying WordPress install folder to www or public_html
- Initiate the installation.
Don’t worry if you didn’t grasp any of the above steps, We will give a visit to all of these steps.
STEP 2: Creating localhost Database
First things first, lets create a database. We will see how to create database for WordPress using phpMyAdmin, a very helpful utility in Wampserver.
- Click the tiny Wampserver taskbar icon and click the option phpMyAdmin, it will be second option from top.
- Type root as the username with NO password. This is default username for phpMyAdmin. Also note, in Wamp phpMyAdmin password for root is nothing.
- You are inside phpMyAdmin now. All the databases you will create appeared on the left hand side. From the top menu, click Databases.
- Enter a database name and click Create. Also remember this name or make a note of it, we will need it later on. For the purpose of this tutorial, we have created a database with name wp_database.
STEP 3: Installing WordPress in WAMP (localhost)
This is where the real fun part begins. We will discuss all we need to install and run WordPress locally.
- Our first step is to download WordPress. It will be downloaded as a zip file.
- Extract the zip file. All the files extracted will be inside a wordpress folder.
- Copy the folder inside www folder. The www is located in wamp64 folder where you installed Wampserver mostly c drive.
- Rename wordpress folder to whatever name you want for your test site. It will also become your localhost website url address. For the purpose of this tutorial, we rename it to newsite.
- From your browser, visit http://localhost/newsite (Remember! this is the folder name in www). WordPress installation begins.
- Select your language and click Next.
- On the next window, it’s already giving us an idea what do we need to install WordPress successfully. We need 5 things
- Database name: our’s is wp_database which we created in phpMyAdmin
- Database username: it will be default username which is root
- Database password: we are not using any password so we will leave this option blank
- Database host: it is localhost
- Table prefix: we will leave this option on its default value.
If you have also sorted out everything, click Let’s go!
- Fill in all the information carefully and click Submit.
- On the next screen, click Run the install
- Fill in all the required information like Site Title, Username and Password for login. Click Install WordPress
Never use easy passwords like 12345 on live websites. We have used it because there is no security risk for offline websites.Woopoo's Caution
See our article choosing strong passwords for more details.
- Well back to our topic…you will be happy to see the Success! message. You can login to your blog right away.
The other way to login to WordPress later on is through url http://localhost/wordpress-site/wp-admin
You are working in localhost but it will give you a 100% online experience. You can make posts, install plugins, experiment with different themes and everything you can think of doing online.
STEP 4: Multiple Websites on Wamp
You can definitely test and run multiple sites on localhost. Just keep in mind that every new install needs a new database to be created in phpMyAdmin and a new WordPress folder need to be copied in www folder. Rename the wordpress folder to newsite2, newsite3 or whatever you want.
In short, each project needs its very own database and its own folder in www.
WordPress localhost Common Errors
Error establishing a database connection
This localhost database error is quite common. If you are getting this message or another message like Can’t connect to WordPress database then it means either you didn’t create a database in phpMyAdmin or you have miss-typed the name of database.
If you haven’t created a database, create one using steps we have discussed above.
localhost refused to connect or showing blank screen
It means localhost is not running on your machine. You can check it by checking the Windows taskbar for Wampserver green icon. If the Wampserver icon is not there, double click the Wampserver desktop shortcut to run it or from the Programs menu.
localhost 404 Not Found
If the localhost url not working, it means the website you are trying to reach doesn’t exist. The url name besides localhost should be the website folder name you have specified in www folder. Check you haven’t misspelled it. Also check Wampserver is running.
WordPress localhost to Live Site
You have made a beautiful website on localhost, now ready to be pushed to your online web hosting. see our detailed article Moving WordPress blog from localhost to live server.
In this article, we have discussed WordPress localhost setup and covered almost all steps to install WordPress locally on WAMP.
If you still have any questions do let us know using the comments section below and we will love to answer.