How to Run WordPress Website on Localhost

To host a WordPress website locally on a computer, you can use a local development environment like XAMPP or WampServer. These software packages provide a complete setup for running a web server, database server, and PHP interpreter on your computer. Let’s learn step-by-step guide on how to do it using XAMPP:

  1. Download XAMPP: Visit the official XAMPP website ( and download the latest version of XAMPP for Windows.
download xampp from

2. Install XAMPP: Run the downloaded installer and follow the on-screen instructions to install XAMPP on your computer. Choose a directory where you want to install XAMPP (e.g., C:\xampp). I only chose to install apache and mysql and unselected filezilla, tomcat and mercury. You may want to select them as per your requirement.

3. Start Apache and MySQL: Launch XAMPP Control Panel after the installation completes. Start the Apache web server and MySQL database server by clicking on the “Start” button next to each service.

start apache and MySql in xampp control panel

4. Create a database: Open your web browser and visit http://localhost/phpmyadmin/. This will open phpMyAdmin, a web-based interface for managing databases. On left side you will see all the databases. Click on “New” to create a new database for your WordPress installation. Choose a name for your database (e.g., “my_test_website_database”) and click “Create.”

phpmyadmin create new database
create database in phpmyadmin xampp localhost

I chose the databse name my_test_website_database , you can choose any name you like use underscore to separate words.

5. Download and extract WordPress: Go to the official WordPress website ( and download the latest version of WordPress. Extract the downloaded ZIP file.

download wordpress files from

6. Configure WordPress: Rename the extracted WordPress folder to the desired name for your website (e.g., “my-test-website”). Open the folder and locate the file named wp-config-sample.php. Rename this file to wp-config.php.

7. Edit the wp-config.php file using a text editor. Look for the following lines:

define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here');
define('DB_NAME', 'my_test_website_database');
define('DB_USER', 'root');
define('DB_PASSWORD', '');

Replace ‘database_name_here’ with the name of the database you created in step 4. Replace the ‘username_here’ as ‘root’ and ‘password_here’ as empty. Keeping the password empty is not a problem as it’s on localhost.

Go to and copy the unique code generated for you and paste it inside wp-config.php file replacing sample values as shown in pictures below.

secret keys generation for wp-config.php file of wordpress website
paste salts

save the file and close it. Remember these details entered are kept to be secret, here i am disclosing only for explaining.

8. Move WordPress files: Move the entire WordPress folder ‘my-test-website’ (renamed in step 6) to the htdocs directory (e.g., C:\xampp\htdocs). Your website files are now in the correct location.

extract downloaded wordpress files and move inside the htdocs folder.

9. Access your WordPress website: Open your web browser and visit http://localhost/your-wordpress-folder-name (e.g., http://localhost/my-test-website). The WordPress installation wizard should appear. Follow the on-screen instructions to set up your website, including providing a site title, username, password, and email address for the admin account. Click “Install WordPress” when you’re done. Remember to save user name and password for login.

wordpress installation
wordpress installation choose username password and email name and site title for your wordpress website
wordpress installation success message

10. Start using your WordPress website: Once the installation is complete, you can log in to the WordPress admin dashboard by visiting http://localhost/your-wordpress-folder-name/wp-admin (e.g., http://localhost/my-test-website/wp-admin). Use the username and password you set up in the previous step.

wordpress website login

You now have a locally hosted WordPress website on your computer using XAMPP. You can start customizing your website, installing themes and plugins, and building your content.

wordpress website admin dashboard

I hope this article has helped you in creating a localhost wordpress website installation on xampp mysql and apache server

Don't Miss Out! Subscribe to Read Our Latest Blogs.

If you found this blog helpful, share it on social media.

Subscription form (#5)

Leave a Comment

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Scroll to Top