Programming Tutorials

How to Install WordPress on XAMPP: Database Setup Guide

Installing WordPress on your own Windows computer is a useful way to learn the dashboard, test themes and plugins, or build a site before moving it to hosting. This guide uses XAMPP to run Apache and MariaDB locally, phpMyAdmin to create the database, and the official WordPress package to complete the installation.

Important: This is a local-development setup. XAMPP is not intended to host a public production website. Keep its services and phpMyAdmin restricted to your own computer.

Advertisement

Before you begin: check the software requirements

Use a maintained XAMPP package whose PHP and database versions are compatible with the WordPress release you plan to install. The WordPress 7.1 compatibility table, published for the release on 19 August 2026, lists PHP 8.2–8.5 and supported database branches including MySQL 8.4/9.7 and MariaDB 10.11, 11.4, 11.8 and 12.3. WordPress.org’s general requirements page recommends PHP 8.3 or later and MariaDB 10.11 or later, or MySQL 8.0 or later. The hosting handbook also marks MySQL 8.0 as end-of-life from 30 April 2026, so choose a maintained database branch for a new environment rather than relying on an old bundle.

One detail often causes confusion: current XAMPP packages include MariaDB rather than MySQL, even though the XAMPP Control Panel may still label the service “MySQL”. MariaDB is designed to be compatible with the MySQL commands used in this tutorial. Check the exact versions included in the XAMPP package before proceeding.

Advertisement
  • A Windows computer with permission to install software.
  • XAMPP downloaded from the official Apache Friends website.
  • The current WordPress ZIP package from WordPress.org.
  • Enough free disk space for the local site and its database.

Step 1: Install XAMPP and start the local services

  1. Download the Windows installer from Apache Friends – XAMPP Downloads.
  2. Run the installer and follow its prompts. The default installation folder is commonly C:\xampp; if you choose another folder, use that location in the steps below.
  3. Open the XAMPP Control Panel.
  4. Click Start beside Apache and the database service (shown as MySQL in the panel).
  5. Open http://localhost/ in your browser. The XAMPP start page should appear when Apache is running.

If Apache or the database service will not start, another application may already be using its port. See the troubleshooting section below rather than changing services at random.

Step 2: Open phpMyAdmin and create a database

With Apache and the database service running, open http://localhost/phpmyadmin/. In a standard XAMPP setup, phpMyAdmin is intended to be accessed from the same computer.

  1. In phpMyAdmin, open the Databases tab.
  2. Under Create database, enter a name such as wp_local.
  3. If a collation must be selected, choose an available utf8mb4 collation. The exact choices can differ between database versions.
  4. Click Create. The new database should appear in the database list.

wordpress_install

Original screenshot retained from the earlier tutorial. The phpMyAdmin layout and labels may look different in a current release.

Create a database user for WordPress

It is better to give WordPress a separate database account instead of relying on a database administrator account. In phpMyAdmin, open User accounts and choose Add user account (the wording may vary by version).

  1. Enter a username, for example wp_user, and set the host to localhost.
  2. Create a strong password and keep it somewhere safe.
  3. Do not grant unnecessary global privileges.
  4. Under database-specific privileges, select wp_local and grant the privileges needed for that database.
  5. Save the account. You will use this username and password in the WordPress setup.

WordPress needs permission to create and update tables in its own database. The official installation guide explains how to assign database-specific privileges in phpMyAdmin.

Step 3: Download WordPress and place its files in htdocs

  1. Download the ZIP package from the official WordPress download page.
  2. Extract the ZIP file. You should see a folder named wordpress.
  3. Open the XAMPP document root, normally C:\xampp\htdocs.
  4. Copy the extracted WordPress folder into htdocs.
  5. For this example, rename the copied folder to mywordpress.

Your local folder should now be C:\xampp\htdocs\mywordpress, and the matching browser address will be http://localhost/mywordpress/. If you installed XAMPP somewhere else, adjust the filesystem path accordingly.

The older screenshots in this article use the example folder name fim. This revised walkthrough uses mywordpress and the database name wp_local. You can choose different names, but use your own folder and database names consistently in the configuration and browser address.

Step 4: Configure wp-config.php

WordPress needs the database name, database username, password and database host to connect to MariaDB or MySQL. You can let the WordPress installer create wp-config.php for you, which is the simpler option for most beginners. Manual editing is optional.

Option A: Let the installer create the configuration file

If wp-config.php is not present, WordPress will offer to create it during setup. Enter the database details you created in Step 2 when prompted.

Option B: Create the file manually

  1. Open C:\xampp\htdocs\mywordpress.
  2. Find wp-config-sample.php and make a copy.
  3. Rename the copy to wp-config.php.
  4. Open it in a plain-text editor and locate the database settings.
  5. Replace the example values with your own details, then save the file.

For the example used in this guide, the settings would look like this:

define( 'DB_NAME', 'wp_local' );
define( 'DB_USER', 'wp_user' );
define( 'DB_PASSWORD', 'replace_with_your_password' );
define( 'DB_HOST', 'localhost' );

Use the password you actually created; do not copy the placeholder. If your database server listens on a non-default port, the host value may need to include that port, for example localhost:3307. Leave the default DB_CHARSET and DB_COLLATE settings unchanged unless you have a specific reason to alter them.

wordpress_install
wordpress_install

These original configuration screenshots are retained for reference. Their example values and older editor layout may not match your installation.

Step 5: Run the WordPress installation wizard

Make sure Apache and the database service are still running. In your browser, visit:

http://localhost/mywordpress/

You can also open http://localhost/mywordpress/wp-admin/install.php directly. WordPress should display its setup screen.

  1. Select your preferred language and continue.
  2. Enter a site title.
  3. Choose an administrator username that is not simply admin.
  4. Create a strong, unique password.
  5. Enter an email address you can access.
  6. Review the search-engine visibility option. A site running only at localhost is not a public website; if you later move a copy to a public staging server, use proper access protection and indexing controls.
  7. Click Install WordPress.

wordpress_install

When the installation completes, WordPress displays a success message and a login link. Sign in with the administrator credentials you just created.

Step 6: Open the dashboard and check the installation

For the example folder used here, the dashboard address is:

http://localhost/mywordpress/wp-admin/

After logging in, check that the dashboard loads, visit the site homepage, and confirm that the database connection is working. You can now practise with themes, plugins, posts and settings without changing a live website.

Continue with the next guide: WordPress Login and Dashboard: A Beginner’s Guide.

Common XAMPP and WordPress installation problems

Problem What to check
Apache will not start Another web server or application may be using port 80 or 443. Check the XAMPP logs and the other service before changing ports.
MariaDB/MySQL will not start Check whether another MySQL or MariaDB service is already using the database port, commonly 3306. Do not run two database servers on the same port.
Error establishing a database connection Check DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. Confirm the database service is running and the user has privileges on the selected database.
Page not found or XAMPP dashboard appears Confirm that the WordPress folder is inside the actual htdocs directory and that the URL uses the same folder name.
Blank page or PHP error Check the PHP version against the WordPress compatibility information and review the Apache/PHP error logs. Avoid displaying detailed errors on any public site.

Security notes: keep XAMPP local

  • XAMPP is intended for development, not as a production web server.
  • Do not expose the XAMPP control panel, phpMyAdmin or the database service to the public internet.
  • Keep phpMyAdmin restricted to the local computer. Do not change its local-only access rule to allow everyone.
  • Use a dedicated database account with privileges limited to the WordPress database.
  • Before moving a local site to hosting, make a backup and follow a proper migration process. A local XAMPP installation is not a substitute for secure production hosting.

Frequently asked questions

Can WordPress create wp-config.php automatically?

Yes. If the file is missing, the WordPress setup process can ask for the database details and create wp-config.php. You only need to edit the sample file manually if you prefer that method or need to troubleshoot the configuration.

Does XAMPP use MySQL or MariaDB?

Current XAMPP packages ship MariaDB. The Control Panel may still use the label “MySQL”, and the usual MySQL-compatible commands and tools are used for the bundled database.

Where should I put the WordPress folder?

Put it inside XAMPP’s document root, normally C:\xampp\htdocs. If the folder is named mywordpress, open http://localhost/mywordpress/.

Do I have to create the database user separately?

For a safer setup, create a dedicated user and grant it privileges on the WordPress database only. The installer needs the correct database name, username, password and host to connect.

Can I use XAMPP to host my live website?

No. Apache Friends describes XAMPP as a development environment, not a production-ready hosting stack. Use a properly secured hosting environment for a public website.

Conclusion

You have now created a database, placed the WordPress files in XAMPP’s htdocs folder, configured the database connection and completed the WordPress setup wizard. This gives you a local WordPress site for learning and testing. Keep the environment private, use software versions that remain supported, and make a backup before experimenting with major changes.

Official references

RochakGuy

Hi, I'm Piyush and I'm a passionate blogger. I love sharing my insights on Rochaksite.com. I'm committed to providing practical and informative content that helps readers achieve their goals and make informed decisions. When I'm not writing, I enjoy exploring new topics and trends in Technology and indulging in my personal hobbies and interests.

Related Articles

Leave a Reply

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

Back to top button