How to Install WordPress on Windows with XAMPP
WordPress is a great Content Management System. It can be used to create nearly all kinds of websites ranging from blogs to e-commerce websites. In order to use WordPress, we also need to install and configure a web server. The Apache Friends project provides a software package named XAMPP, which comes with Apache, PHP and MySQL pre-configured out of the box.
In this post, you will learn how to install WordPress on a Windows computer using XAMPP.
The first step is to install the XAMPP package. Go to the Apache Friends website and download the Windows version.
Once the download is complete, run the executable installer file. You will be prompted to check the components that you wish to install. To run WordPress, we need PHP, MySQL, Perl and the Apache web server.
Complete the rest of the installation steps by following through all the steps in the installer. When it’s done, launch the “XAMPP Control Panel” through the Start menu. The control panel allows you to can start and stop the web server, change configuration settings and view server logs.
Now, we’ll check whether the server is working. Click on the start button for Apache and MySQL on the control panel. The Windows firewall (or any other antivirus installed on your system) may warn you at this point; be sure to click “Allow” (or a similar option) so that the web server works properly.
Next, open your favourite browser and navigate to
localhost, which tells your browser to connect to the website hosted on your own computer. If the setup was successful, you should be able to see the default web page, as shown in the screenshot below:
Now that we’ve installed XAMPP successfully, we will now install WordPress. But before we can do that, we need to set up the database.
Setting up the database
Setting up the database consists of two steps — securing MySQL and setting up a user and a database for WordPress.
Securing the database
To secure the MySQL database, we simply need to run the
mysql_secure_installation script that comes with the XAMPP package. In order to do so, click on the “Shell” button in the Control Panel, and type in:
Now, the script will ask for the root password. Since we’ve just set things up, there is no root password set, so simply hit enter.
Then, the script will offer the option to set a root password. Type in
y and then type in a password. The script will also ask you a variety of questions, such as if it should remove anonymous users and disallow remote root logins. Answer yes to all of these questions by entering
y. With this, your MySQL database should be secure now.
Setting up users and databases
Next, we need to create a database into which WordPress stores all its data. In addition, we’ll create a separate user account for WordPress for better security. In the XAMPP shell, type in:
mysql\bin\mysql.exe -u root -p
Type in your MySQL root password. You’ll be provided with a MySQL shell where you can type in SQL statements.
First, we’ll create the database with the following command:
create database wordpress;
Next, we’ll create an user account for WordPress to connect to the MySQL database. Here, we’ve used an username
wordpress and password of
pa$$w0rd. This password shouldn’t be the same as the root password.
create user [email protected] identified by 'pa$$w0rd';
Finally, we need to give this user to operate on the
grant all privileges on wordpress . * to [email protected];
Now that our database setup is complete, we can install WordPress within XAMPP.
Head over to the WordPress download page and download the ZIP file.
Then, head over to XAMPP’s
htdocs folder. You can do so easily by selecting XAMPP → XAMPP htdocs folder from the Start menu. Delete all the files here, and extract the
wordpress folder from the ZIP file into this directory. The folder will end up looking like this:
Now, point your browser to
http://localhost/wordpress to begin the setup. Set your preferred language and click on Continue. Then, you will be asked to enter your database configuration. Enter the database name and username as
wordpress. In the password field, enter the password you’ve set for the
wordpress user. Then, click on the Submit button to continue.
In the next page, you will be asked to give your site title, email, username and password. You need to remember them as these are the credentials that you will need to login to the WordPress admin panel.
Finally, click on “Install WordPress”. You will be redirected to a page confirming that WordPress has been installed.
Now click on Log in and enter the username and password that you just set in the previous step. Alternatively, you may visit
http://localhost/wordpress/wp-admin to open the login screen.
Log in with your username and password and you will be presented with the WordPress admin panel.
Voila! You have successfully installed WordPress locally using XAMPP. To view the site, go to
http://localhost/wordpress. The default website looks like this:
Having installed WordPress, you may want to experiment with various themes and plugins. You can download them from the admin panel, fiddle with various settings to customize your website. We would love to hear your experience. Drop in your comments below!