Unlike many blogging platforms, WordPress gives you the freedom to use it locally. All you need to do is set up a local server using MAMP (for Mac) or XAMPP (for Windows) and then you can install WordPress on your computer.
Right now, you must be thinking – why should I install WordPress on my local computer?
In order to use WordPress, you need to buy a hosting account. So it is better to get a feel of the CMS on your local computer first, and then buy a hosting account based on your needs.
Not only that – before using a new theme or a plugin on your existing website, it is always recommended to use them on a staging site or on your local WordPress installation. Why? The new theme or plugin may conflict with the core files or the existing plugins and this will break your live website.
Also, a locally installed WordPress site helps theme and plugin developers to test and tweak their codes on their computer. They don’t have to depend on any internet connection and a remote server. This speeds up the overall development process and saves a lot of time.
Now that you know the advantages, it is time to get started with the actual process of installing WordPress on your Windows computer using XAMPP.
So, what do we need?
- Local server – We will use XAMPP to create a local server environment on our PC
- WordPress software – You can download the latest version from WordPress.org
XAMPP is a web server solution that allows you to run PHP and MySQL codes. Since WordPress runs using PHP and needs MySQL to store data, hence we will use XAMPP as our local server.
So head over to Apache Friends website and download the latest version of XAMPP for Windows. Once done, let’s install it on our computer by starting the setup process.
XAMPP can be installed just like any other software. However, there are some important things which I’ll share with you.
When asked to select components, you should check MySQL and phpMyAdmin. Apache and PHP will be installed by default. These four components are important for us. You may uncheck the rest.
Next step is to select the folder on which you want XAMPP to be installed. In my case, I have installed it on C: drive. However, you can install it on any folder you like.
In the next step, you will be given information about Bitnami for XAMPP application modules. You don’t have to install any such module as we will install WordPress manually. So uncheck the Learn more about Bitnami for XAMPP option and proceed to the next step.
Rest of the process is simple. Just follow the steps and the software will be installed without any problem. Once installed, let us open the XAMPP Control Panel. You will see a window like the following:
Time to test whether our local server is working properly or not!
Start Apache and MySQL using the XAMPP Control Panel – this will start our server. Now open your web browser and go to http://localhost. If you see the XAMPP start page just like the following, your local server is working perfectly.
The second step is to create a database which will store important data like posts, categories, tags, and other details.
Open your web browser and go to http://localhost/phpmyadmin. Make sure you have started the services Apache and MySQL from the XAMPP control panel before opening the mentioned address.
You will find the existing databases on the left side of this page.
Let us now create the database for our local WordPress installation. Click on Database and a new page will open up:
You will find a text box asking for the new database name. You can name it as per your wish. But make sure you remember it.
Let me name it wordpress and click on Create. That’s it, the database has been created. Simple, isn’t it?
However, our database is empty. We have to connect it with WordPress, which we will do in the next step.
As you know, WordPress is an open source software. So visit WordPress.org to download the latest version of the software. Once you have downloaded it, open the zip folder and copy the WordPress folder inside C:/xampp/htdocs/.
It’s time to start the installation process. You can do this using any one of the following methods:
- Without editing wp-config.php file (Recommended for non-programmers)
- wp-config.php file
Without Editing wp-config.php file
This method is best for those who find it difficult to deal with codes. Just follow the steps and install WordPress on your local computer.
First of all, you need to open your web browser and type the following URL in the address bar. This will open the language selection page. Again, make sure Apache and MySQL are running. If not, start them from the XAMPP control panel.
WordPress is available in many languages. You can select any language of your choice. Let me choose English (United States) and click on Continue.
A welcome page will open up and will inform that you need some information like database name, username, password and hostname on the next page. These are required for connecting the database to your WordPress installation.
Don’t worry! We have all the information we need. So, click on Let’s go.
Now you need to enter the following database details on this page:
1. Database Name – wordpress. If you have named it something other than wordpress, please enter that name.
2. Username – root. The default username is root unless you have changed it.
3. Password – The default password is set as blank.
4. Database Host – localhost
5. Table Prefix – wp_
Once you have entered the above details, please click on Submit and proceed to the next page.
Now click on Run the install and wait for WordPress to communicate with the database.
Remember – if the information provided in the database details page are not correct, you will get some errors.
WordPress will now connect to the database successfully and a page will open up asking you to enter blog details like site name, username, password and email. Make sure you remember your username and password as you will need them to log in to your WordPress Dashboard.
Once you are done, click on Install WordPress.
This will take maximum 5 minutes to install the software on your computer. Once complete, a success page will open up.
Now click on Log in to go to the login page.
Enter your username and password and click on Log in. This will take you to the WordPress Dashboard.
That’s it. You have successfully installed WordPress on your local computer.
This method is for those who have some programming knowledge. If you don’t have any coding experience, better follow the above method.
WordPress folder comes with a file called wp-config-sample.php. This file contains the code that can communicate with the database. We will edit this file and will save it as wpconfig.php.
So go to C:/xampp/htdocs/wordpress and open wp-config-sample.php file. You can open the file using Notepad that comes with Windows. You can also use any text editor like Notepad++ or Sublime Text.
Let me use Notepad++ to open the wp-config-sample.php file.
Now find the following code:
/** The name of the database for WordPress */ define('DB_NAME', 'database_name_here'); /** MySQL database username */ define('DB_USER', 'username_here'); /** MySQL database password */ define('DB_PASSWORD', 'password_here'); /** MySQL hostname */ define('DB_HOST', 'localhost');
And replace it with the following:
/** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', ''); /** MySQL hostname */ define('DB_HOST', 'localhost');
If your database name is anything other than wordpress, please edit the above code with that name. The database username is root, the password should be kept blank, and the hostname should be localhost.
Once done, save the file as wp-config.php.
Now open your browser and go to http://localhost/wordpress. If the details provided in the wpconfig.php file are correct, then the language selection page will open up and will ask you to select your preferred language.
In the next page, you will be asked to enter blog details like website name, username, password, and email.
After filling the required details, click on Install WordPress. Once the process is complete, you will be redirected to a success page.
Congrats! You have installed WordPress locally using the wpconfig.php method.
What are you waiting for? Try to install WordPress on your Windows computer using XAMPP. If you face any problem, let me know using the comment section and I will solve it for you.
If you liked this article, please share it on your favorite social media profile 😉