Skip to content
Follow
CMS Windows

How to Install phpMyAdmin with Apache on Windows WSL

Richard
Written by
Richard
May 31, 2021 Updated Apr 1, 2026 5 min read
How to Reset Your Microsoft Account Password
How to Reset Your Microsoft Account Password

You install phpMyAdmin with Apache on Windows WSL to manage MySQL and MariaDB databases via a web browser.

phpMyAdmin is a free, open-source graphical tool that simplifies complex database administration tasks, offering an alternative to command-line interfaces.

This guide shows you how to set up phpMyAdmin and Apache within Windows Subsystem for Linux (WSL 2), a powerful combination for developers and students working with databases.

You can perform essential operations like running SQL queries, creating new users, and backing up your databases directly from your web browser.

⚡ Quick Answer

Install phpMyAdmin with Apache on Windows WSL by enabling WSL and Virtual Machine Platform features, installing Ubuntu from the Microsoft Store, then installing Apache and MariaDB within Ubuntu using apt commands.

Getting Started

Step 1Enable WSL in Windows

WSL is a Windows feature that you need to turn on first.

  1. Click the Start button and type PowerShell
  2. Right-click on Windows PowerShell and select Run as administrator ⚠️ Requires admin privileges
PowerShell terminal running as administrator for WSL setup
powershell administrator

In the PowerShell window, copy and paste this command:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

You should see a success message like this:

Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19042.844
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Step 2Enable Virtual Machine Platform

WSL 2 needs another Windows feature called Virtual Machine Platform.

In the same PowerShell window, copy and paste this command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you have Windows 10 version 2004 or older, use this command instead:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

Now restart your computer to apply all changes.

After your computer restarts, open PowerShell as administrator again and run this command:

wsl --set-default-version 2

Step 3Install Ubuntu on Windows

Now WSL 2 is ready. You need to install Ubuntu, which is a Linux operating system.

Click this link to download Ubuntu from the Windows Store: Get Ubuntu 20.04 LTS – Microsoft Store

Ubuntu installation on Windows WSL for phpMyAdmin
ubuntu windows wls install

Click the Get button and wait for it to install.

When done, click Launch to start Ubuntu for the first time.

Ubuntu will ask you to create a username and password. Choose anything you want:

Enter new UNIX username: user123
New password: (type your password)
Retype new password: (type it again)
passwd: password updated successfully
Installation successful!

You’ll see a welcome message from Ubuntu. This means it’s working!

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
System information as of Mon Apr 12 17:57:37 CDT 2021
System load: 0.52 Processes: 7
Memory usage: 26% IPv4 address for eth0: 192.168.1.100

If you run into problems, try these commands:

wsl --set-default-version 1
bcdedit /set hypervisorlaunchtype auto start

Step 4Install Apache Web Server

What is Apache? Apache is the web server software that will run phpMyAdmin. It’s what turns your Linux computer into a web server.

In Ubuntu, run these commands:

sudo apt update
sudo apt install apache2

⚠️ These commands require admin privileges (sudo)

To control Apache, use these commands:

sudo service apache2 stop (turns it off)

sudo service apache2 start (turns it on)

sudo service apache2 restart (restarts it)

Does it work? Open your web browser and go to:

http://localhost

You should see Apache’s test page.

LAMP stack setup on Windows WSL with Ubuntu
lamp windows wsl ubuntu

Step 5Install MariaDB Database Server

What is MariaDB? MariaDB is the database software. It stores all your data safely.

Run these commands:

sudo apt-get install mariadb-server mariadb-client

⚠️ Requires admin privileges

To control MariaDB, use these commands:

sudo service mysql stop (turns it off)

sudo service mysql start (turns it on)

sudo service mysql restart (restarts it)

Now secure your database with a password:

sudo mysql_secure_installation

⚠️ Requires admin privileges

Answer the questions like this:

Enter current password for root (enter for none): Press Enter
Set root password? [Y/n]: Y
New password: (type your password)
Re-enter new password: (type it again)
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

Did it work? Test by logging in to the database:

sudo mysql -u root -p

Type your password when asked. You should see:

Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 46
Server version: 10.3.29-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
MariaDB [(none)]>

Type exit to leave.

Step 6Install PHP

What is PHP? PHP is the programming language that phpMyAdmin uses. You need it to run phpMyAdmin.

Run this command to install PHP and the tools it needs:

sudo apt install php libapache2-mod-php php-common php-mysql php-gmp php-curl php-intl php7.4-mbstring php-xmlrpc php-gd php-xml php-cli php-zip

⚠️ Requires admin privileges

Did it work? Check the PHP version:

php -v

You should see something like:

PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

To test PHP more thoroughly, create a test file:

sudo nano /var/www/html/phpinfo.php

⚠️ Requires admin privileges

Type this inside the file:

<?php phpinfo( ); ?>

Press Ctrl+X, then Y, then Enter to save.

Restart Apache:

sudo service apache2 restart

Now open your browser and go to:

http://localhost/phpinfo.php

You should see a page showing all your PHP information.

Testing PHP on Windows WSL with Apache server
lamp windows wsl php test

Step 7Install phpMyAdmin

What is phpMyAdmin? This is the tool you’ll use to manage your databases through a web page.

Run this command:

sudo apt install phpmyadmin

⚠️ Requires admin privileges

When asked which web server to use, select apache2 and press Enter.

Please choose the web server that should be automatically configured to run phpMyAdmin.
[*] apache2
[ ] lighttpd

When asked “Configure database for phpmyadmin with dbconfig-common?”, select Yes.

Create a password for phpMyAdmin when asked. Remember this password.

About root access: MariaDB has a special security feature that may block the root user from logging into phpMyAdmin. If you want to use the root account, follow these steps:

Log into MariaDB:

sudo mysql

⚠️ Requires admin privileges

Run these commands:

USE mysql;
UPDATE user SET plugin='' WHERE user ='root';
FLUSH PRIVILEGES;
EXIT;

Restart Apache:

sudo service apache2 restart

Now open phpMyAdmin by going to:

http://localhost/phpmyadmin

Installing phpMyAdmin on Windows WSL environment
phpmyadmin windows wsl install

You should see a login page. Log in with your root username and password.

phpMyAdmin dashboard interface on Windows WSL
phpmyadmin windows wsl dashboard

You’re done! You can now manage your databases from phpMyAdmin.

Summary

You just learned how to set up a complete database management system on Windows using WSL. Here’s what you did:

  • Enabled WSL 2, which lets you run Linux on Windows
  • Installed Ubuntu, a Linux operating system
  • Installed Apache, a web server
  • Installed MariaDB, a database system
  • Installed PHP, a programming language
  • Installed phpMyAdmin, a web tool to manage databases

Now you have a powerful system for storing and managing data. You can use phpMyAdmin’s simple interface instead of typing complicated database commands.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Access Linux Files on Windows 11 Using WSL
Windows How to Access Linux Files on Windows 11 Using WSL
How to Mount Linux File System on Windows 11 via WSL
Ubuntu Linux How to Mount Linux File System on Windows 11 via WSL
How to Change Default Distro in Windows Subsystem for Linux
Windows How to Change Default Distro in Windows Subsystem for Linux
How to Open PowerShell in Windows 11
Windows How to Open PowerShell in Windows 11

0 Comments

  • thanks, that was helpful

    Reply
  • francisco

    Straight, clear. Very helpful
    Thank you

    Reply
  • ShoeRiderr

    Don’t use UPDATE user SET plugin=” WHERE user =’root’;

    It will broke your authentication system when you define password earlier

    Reply

Leave a Comment

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