How to Install phpMyAdmin on Windows 11 with WSL
You can install phpMyAdmin on Windows 11 using WSL to manage MySQL and MariaDB databases via a web interface.
phpMyAdmin, a free and open-source PHP application, offers a user-friendly method for managing MySQL and MariaDB database servers. This tool simplifies common tasks, including managing databases, handling users, and running SQL queries.
This approach uses the Windows Subsystem for Linux (WSL2), the latest version which offers improved performance and full Linux compatibility on your Windows 11 machine. WSL2 ensures you can run Linux applications seamlessly.
Install WSL by running `wsl –install` in an administrator Command Prompt, then install a Linux distribution like Ubuntu using `wsl –install -d ubuntu-20.04`. Finally, set up a web server and the phpMyAdmin package within your Linux environment.
Install Windows Subsystem for Linux in 🪟 Windows 11
Installing the Windows Subsystem for Linux (WSL) on Windows 11 lets you run Linux tools right on your PC. First, open the Command Prompt as an administrator by searching for it in the Start menu and selecting ‘Run as administrator’. Then, type the command ‘wsl –install’ and press Enter to begin the installation.
Next, right-click the Command Prompt app and choose to Run as administrator.

When the console opens, run the commands below to install Windows Subsystem for Linux (WSL):
wsl --install
Wait for WSL to be installed.
After installing, you should get a success message similar to the lines below:
Installing: Virtual Machine Platform Virtual Machine Platform has been installed. Installing: Windows Subsystem for Linux Windows Subsystem for Linux has been installed. Downloading: WSL Kernel Installing: WSL Kernel WSL Kernel has been installed. Downloading: GUI App Support Installing: GUI App Support GUI App Support has been installed. Downloading: Ubuntu The requested operation is successful. Changes will not be effective until the system is rebooted.
Restart your computer.
WSL should be installed and ready to use. When you want to update, simply run the commands below:
wsl --update
Install Specific Linux distro on 🪟 Windows 11
After installing WSL, you can choose which Linux distribution to use on your Windows 11 computer. To see a list of available options, open your Command Prompt and type ‘wsl –list –online’. This command will show you all the Linux distros you can install, like Ubuntu or Debian, so you can pick the one that fits your needs.
wsl --list --online
You should then see all available distributions that can be installed on WSL.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTSTo install a Linux distribution from the list above, simply run the commands below using the distribution name. For example, to install Ubuntu 20.04, run the commands below:
wsl --install -d ubuntu-20.04You should then get a message that the distribution is installed.
Downloading: Ubuntu 20.04 LTS Installing: Ubuntu 20.04 LTS Ubuntu 20.04 LTS has been installed. Launching Ubuntu 20.04 LTS.
After installing, you should get a Ubuntu command console with setup details.
Installing, this may take a few minutes.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: Richard
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-22000-Microsoft x86_64)Some troubleshooting commands to run when you run into issues.
wsl --set-default-version 1 bcdedit /set hypervisorlaunchtype auto start
Now that Ubuntu Linux is installed and ready, continue below to install the LAMP server to run WordPress. First, install Apache HTTP Server.
Install Apache HTTP Server
Apache is a popular web server that helps websites run, and you can install it on your Linux setup within Windows 11. To get Apache installed on Ubuntu, open your Linux terminal and run the commands ‘sudo apt update’ followed by ‘sudo apt install apache2’. This will set up the web server so you can start hosting sites.
To install Apache on Ubuntu, run the commands below:
sudo apt update sudo apt install apache2
After installing Apache2, the commands below can be used to stop, start and restart Apache2 services.
sudo service apache2 stop sudo service apache2 start sudo service apache2 restart
To validate that Apache is installed and functioning, open your web browser and browse to the server’s hostname or IP address.
You should get a test page if every work.
http://localhost

Install MariaDB Database Server
MariaDB is a fast and secure database server that works well with web projects, and it’s easy to install on your WSL Linux system. To install MariaDB and its client tools, open your Linux terminal and run the command ‘sudo apt-get install mariadb-server mariadb-client’. This sets up the database needed for phpMyAdmin.
To install MariaDB, run the commands below:
sudo apt-get install mariadb-server mariadb-client
After installing MariaDB, the commands below can be used to stop, start and restart MariaDB services.
sudo service mysql stop sudo service mysql start sudo service mysql restart
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- 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
To verify and validate that MariaDB is installed and working, log in to the database console using the commands below:
sudo mysql -u root -p
Type the root password when prompted.
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
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>The server was successfully installed if you see a similar screen.
PHP and Related Modules
PHP is a programming language needed for many web applications, including phpMyAdmin, and you can install it on your WSL setup. To install PHP along with the necessary modules for Apache and MariaDB, open your Linux terminal and run the command ‘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’.
To install PHP and recommended modules, run the commands below.
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
That should get PHP installed with recommended PHP modules that you can run with many PHP-based applications.
To validate that PHP is installed, run the commands below:
php -v
You should see an output like the one below:
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 with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
You can also test with a test PHP script and display the installed version and related modules that are enabled or disabled.
To do that, run the commands below to create a PHP test file called phpinfo.php
sudo nano /var/www/html/phpinfo.php
Then type the content below and save the file.
<?php phpinfo( ); ?>
Save the file.
Open your browser and browse to your server hostname followed by phpinfo.php
Restart Apache, then type the address and browse the file.
http://example.com/phpinfo.php
You should see the PHP default test page.

Install phpMyAdmin
With Apache, MariaDB, and PHP ready on your WSL system, you can now install phpMyAdmin to manage your databases easily. Open your Linux terminal and type the command ‘sudo apt install phpmyadmin’. During the installation, you’ll be asked to choose your web server; make sure to select ‘apache2’ when prompted.
sudo apt install phpmyadmin
During the installation, you’ll be prompted to select the webserver to run with phpMyAdmin.
+------------------------+ Configuring phpmyadmin +-------------------------+
| Please choose the web server that should be automatically configured to |
| run phpMyAdmin. |
| Web server to reconfigure automatically: |
| |
| [*] apache2 |
| [ ] lighttpd | |
| <Ok> |
+---------------------------------------------------------------------------+Select Yes when prompted again to allow web config-common to install a database and configure.
+------------------------+ Configuring phpmyadmin +-------------------------+
| |
| The phpmyadmin package must have a database installed and configured |
| before it can be used. This can be optionally handled with |
| dbconfig-common. |
| |
| If you are an advanced database administrator and know that you want to |
| perform this configuration manually, or if your database has already |
| been installed and configured, you should refuse this option. Details |
| on what needs to be done should most likely be provided in |
| /usr/share/doc/phpmyadmin. |
| |
| Otherwise, you should probably choose this option. |
| |
| Configure database for phpmyadmin with dbconfig-common? |
| |
| <Yes> <No> |
| |
+---------------------------------------------------------------------------+Enter a password and confirm for phpMyAdmin to register with the database, then select OK and complete the installation.
MySQL and MariaDB have a feature that provides root authentication via an auth_socket plugin.
This plugin authenticates users who connect from the local host via a socket file without prompting or using a password. You won’t be allowed if you attempt to log on to phpMyAdmin with the MariaDB root account.
If you wish to use the root account to log on to phpMyAdmin, use the steps below. You’ll need to change the default authentication mechanism from auth_socket to mysql_native_password to fix that.
Login back into the MariaDB console.
sudo mysql
Then run the commands below to change to turn off mysql_native_password module.
USE mysql; UPDATE user SET plugin='' WHERE user ='root';
Save your changes and exit:
FLUSH PRIVILEGES; EXIT;
Restart Apache and browse to phpMyAdmin web portal using the URL:
http://localhost/phpmyadmin
That will bring up the login page, where you should be able to do so with the root account.

Begin managing your database server from the phpMyAdmin portal.

Conclusion:
Setting up phpMyAdmin on Windows 11 using WSL provides a powerful and efficient environment for managing MySQL databases. Here are the key takeaways:
- Accessible Interface: phpMyAdmin offers a user-friendly web interface for database management.
- Integration with WSL: Running phpMyAdmin within WSL eliminates the need for additional software installations or virtual machines.
- Powerful Features: It supports database tasks such as executing SQL queries, managing user accounts, and importing/exporting data.
- Enhanced Performance with WSL2: WSL2’s improved performance and compatibility make it an excellent choice for developers.
- Step-by-Step Installation: The installation process is straightforward, with step-by-step guidance available for each component (WSL, Apache, MariaDB, PHP).
- Security Considerations: Proper configuration of database access and user authentication enhances security.
- Easily Manage Databases: With phpMyAdmin, you can efficiently manage and monitor your database instances from any web browser.
phpMyAdmin offers valuable benefits for students and developers managing databases on Windows 11. This database management tool simplifies tasks such as creating tables, running SQL queries, and checking data. Its user-friendly interface makes database administration easier, even for those new to database work.
Was this guide helpful?
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.
You also need to copy the phpmyadmin configuration file to the apache directory and enable it.
Run these:
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo service apache2 restart