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.
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.
- 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
- Download the Windows installer from Apache Friends – XAMPP Downloads.
- 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. - Open the XAMPP Control Panel.
- Click Start beside Apache and the database service (shown as MySQL in the panel).
- 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.
- In phpMyAdmin, open the Databases tab.
- Under Create database, enter a name such as
wp_local. - If a collation must be selected, choose an available
utf8mb4collation. The exact choices can differ between database versions. - Click Create. The new database should appear in the database list.
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).
- Enter a username, for example
wp_user, and set the host tolocalhost. - Create a strong password and keep it somewhere safe.
- Do not grant unnecessary global privileges.
- Under database-specific privileges, select
wp_localand grant the privileges needed for that database. - 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
- Download the ZIP package from the official WordPress download page.
- Extract the ZIP file. You should see a folder named
wordpress. - Open the XAMPP document root, normally
C:\xampp\htdocs. - Copy the extracted WordPress folder into
htdocs. - 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
- Open
C:\xampp\htdocs\mywordpress. - Find
wp-config-sample.phpand make a copy. - Rename the copy to
wp-config.php. - Open it in a plain-text editor and locate the database settings.
- 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.
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.
- Select your preferred language and continue.
- Enter a site title.
- Choose an administrator username that is not simply
admin. - Create a strong, unique password.
- Enter an email address you can access.
- Review the search-engine visibility option. A site running only at
localhostis not a public website; if you later move a copy to a public staging server, use proper access protection and indexing controls. - Click Install WordPress.
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
- WordPress: How to install WordPress
- WordPress: Editing wp-config.php
- WordPress: Server requirements
- WordPress Hosting Handbook: Compatibility table
- Apache Friends: XAMPP for Windows FAQ










