Managing a database is a complex but necessary part of running a website. Luckily, software like phpMyAdmin exist to make the process much easier. This popular administration tool may seem challenging to learn, but accessing and modifying your database will be a breeze once you have the hang of it.

The most difficult part is knowing how to install phpMyAdmin and setting it up on your web server. If you’re having trouble, you’re certainly not the only one.

In this article, we’ll show you step by step how to install phpMyAdmin on all major operating systems, plus how to configure it from there.

Let’s get going!

Prefer to watch the video version?

What Is phpMyAdmin?

Behind every website is a database. This database allows you to store data ranging from user account information to the posts you make on your site. While there are many database services, MySQL is the most popular one. And most likely, it’s the one your website is using. MariaDB is a common alternative.

Interacting directly with MySQL can be complicated and confusing, especially if you’re new to website administration. But interacting with your databases is often a necessary part of site maintenance.

phpMyAdmin was created to bring a browser-based visual interface to MySQL and make it easier to work with your database. Due to its popularity, many web hosting services include access to phpMyAdmin, including Kinsta.

Why Do You Need phpMyAdmin?

Without a tool like phpMyAdmin, your only option for accessing the database is with the command line. It means you have no visual interface — just a text prompt where you put in commands. Doing it this way can be confusing and may even lead to accidentally breaking your site.

phpMyAdmin is free and open source. A wide range of web hosts supports it, and you can even install it yourself without paying a single cent. And once you’ve installed it, executing database commands from the visual interface is much more intuitive.

Still on the fence? You can try phpMyAdmin yourself to see if it’s a database manager you’d like to use. Once you’ve given it a test drive and decided you’d like it, you can install the tool on your server.

phpMyAdmin Requirements

The requirements to install phpMyAdmin are, luckily, relatively simple. If you have a web server of any kind, you should almost certainly be able to get it running. Here are the detailed requirements:

  • A webserver of any kind
  • MySQL or MariaDB 5.5 or newer
  • A web browser that supports Javascript, cookies, and Bootstrap 4.5 (to access phpMyAdmin)
  • PHP 7.2.5 or newer
  • Additional PHP requirements: The session and SPL extensions, hash, ctype, and JSON support. Other extensions such as mbstring can improve performance or add additional minor functionality (see the requirements page for the complete list).
phpMyAdmin system requirements
phpMyAdmin system requirements.

Before you try to install phpMyAdmin, remember that many web hosts already come with it installed. Kinsta is among them; if you want to access the database manager, log into your Kinsta account, then go to the Info tab and look for Database Access.

Before installing phpMyAdmin, check your web host’s documentation to ensure they’ve not installed it already.

Step By Step: Installing phpMyAdmin

Once you’ve checked to make sure your server supports phpMyAdmin, it’s time to get to work installing it. Web servers come in a wide range of operating systems, so we’ve included all the most popular ones, including Windows, Mac, and multiple distributions of Linux.

With that, here are the step-by-step instructions for installing phpMyAdmin.

How to Install phpMyAdmin on Windows 10

As the requirements state, you’re going to need a web server with PHP and a database to use phpMyAdmin. While you can undoubtedly download Apache, PHP, and MySQL manually, there’s a much simpler option to get a server up and running on a Windows computer.

WAMP (Windows, Apache, MySQL, and PHP) is free software that easily allows you to create a server with all prerequisites. You can also try XAMPP for Windows (Apache, MariaDB, PHP, and Perl) if it suits your needs better.

WAMPServer's homepage, screenshot.
WAMPserver’s homepage.

Once you have one of these downloaded, it’s just a matter of installing it and walking through the setup process.

Suppose you’re using WAMP or XAMPP. Both of these come with phpMyAdmin already! In your browser, navigate to http://localhost/phpMyAdmin, and you should see the login screen, confirming that you’ve installed everything correctly.

How to Install phpMyAdmin on Mac

Getting phpMyAdmin on a Mac is a little different. All the prerequisites are the same. But as macOS ships with both Apache and PHP, you don’t need to download them.

With Mac, you have two options: You can use XAMPP just like with other operating systems or install everything manually.

XAMPP OSX download list.
XAMPP OSX download list.

Download XAMPP for OS X, open it, and drop it into your Applications folder.

Open XAMPP Control from /Applications/XAMPP/manager-osx.app to start your Apache and MySQL servers. If you then visit http://localhost, you should find everything working correctly and your phpMyAdmin login under the “Tools” section.

If you’d instead install phpMyAdmin manually, the process is simple. Since you already have Apache and PHP, you only need to download MySQL. Make sure you select macOS from the dropdown. Download and install the file, follow the instructions, and record any usernames and passwords given to you.

You can then open System Preferences and launch MySQL to start a server. You can also start Apache by running this command in the Terminal:

sudo apachectl start
Command to start Apache in Mac Terminal.
Command to start Apache in Mac Terminal.

With that, all that’s left is installing phpMyAdmin. Rename the folder to “phpMyAdmin” and move it to /Library/WebServer/Documents/. Check to make sure it’s installed correctly by visiting http://localhost/phpMyAdmin in the browser.

If you have Homebrew installed, another option is to put in the command: brew install phpMyAdmin.

How to Install phpMyAdmin on Ubuntu

As one of the most popular and most accessible to use Linux distributions, Ubuntu is a good choice for your server.

While manual installation of Apache and MySQL is always possible, Linux has its own “stack” of standard server software known as LAMP (Linux, Apache, MySQL, and PHP). Unlike WAMP and XAMPP, this does not come with phpMyAdmin, so you’ll need to install it manually. Luckily, Ubuntu allows you to do all of your installations through the command line.

First, check that tasksel is enabled. Server editions of Ubuntu should come with it installed, but if you have a desktop edition, you can enable it with this command:

sudo apt-get install tasksel

After that, you can use tasksel to install a LAMP server with this command:

sudo tasksel install lamp-server
Installing LAMP server via command line in Ubuntu.
Installing LAMP Server via command line in Ubuntu.

Now, you can install phpMyAdmin:

sudo apt install phpMyAdmin

With that, you have all the necessary files to run a server on your computer.

How to Install phpMyAdmin on CentOS 7

Installing phpMyAdmin on CentOS 7 is very similar to other distributions, but the commands are slightly different as this OS uses Yum rather than the typical apt command.

There’s also no simple LAMP stack that installs all the server components you need at once, so you’ll need to download Apache, MySQL, and PHP manually. Thankfully these can be easily obtained through the command line.

First, let’s get a LAMP stack downloaded using the command line, beginning with Apache:

sudo yum install httpd.service

To start the Apache server and ensure it runs on boot, use these commands:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Now it’s time to install a database. CentOS 7 defaults to installing MariaDB. It is also fully compatible with phpMyAdmin, so it’s safe to use. While it’s possible to download MySQL instead, it’s a much more complicated process. Let’s use MariaDB:
sudo yum install mariadb-server mariadb

Now we can run it and cause it to start at boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb.service

To finish installing MariaDB and ensure it’s secure, run the secure installation setup with the following command.

sudo mysql_secure_installation

Last, we can install PHP with the additional MySQL package.

sudo yum install php php-mysql

You’ll also need to restart the Apache server, so it works properly with PHP.

sudo systemctl restart httpd.service

With that, you have the LAMP stack you need and can finally get to downloading phpMyAdmin. As it isn’t in the Yum repository, you’ll need to install the EPEL repository instead with this command:

sudo yum install epel-release

And install phpMyAdmin.

sudo yum install phpMyAdmin

It takes a few more steps on CentOS 7, but you should now have a server ready for configuration.

How to Install phpMyAdmin on Debian

Much like CentOS 7, you’ll need to install a LAMP stack using the command line manually. First, let’s get Apache with this command:

sudo apt install apache2

Next, we’ll install MariaDB. Like CentOS 7, this Linux distribution works better with MariaDB, and we recommended you use that one instead.

sudo apt install mariadb-server

And like with CentOS 7, you should run the secure installation to add a database password and ensure that everything is secure.

sudo mysql_secure_installation

Finally, we can install PHP and a few extra packages your server will need to work.

sudo apt install php php-mysql libapache2-mod-php

And we can finish off by installing phpMyAdmin.

sudo apt install phpMyAdmin

How to Access phpMyAdmin

Once you have phpMyAdmin appropriately installed, accessing it and logging in is the same on any operating system.

You’ll need your web server’s address, then append /phpMyAdmin/ to the end of it. If you just set up a server on your computer, the address is very likely simply “localhost,” so visit this link:

http://localhost/phpMyAdmin

It may also be an IP, or even a named address if this is a server you already have running on the web. If you’re not sure, you can likely find the address in your Apache or MySQL config files.

Once you’re on the login screen, you’ll need a username and password. If this is a fresh installation, the username is likely “root,” and you can leave the password blank. If that doesn’t work, the password may be “password.”

phpMyAdmin's login screen.
phpMyAdmin login screen.

If you can’t log in, check the phpMyAdmin or MySQL config files to find your login info. You may have also changed the login info during the installation process.

Linux users should try the following Linux command if they’re having trouble accessing the page or logging in:

sudo dpkg-reconfigure phpMyAdmin

Lastly, you should note that if you’re using a web host such as Kinsta with phpMyAdmin preinstalled, you can usually find login info and links in your hosting dashboard. In this case, you don’t need to install phpMyAdmin on the server manually.

Configuring phpMyAdmin

With the database manager installed and ready to go on your system, you should know how to configure phpMyAdmin. Like with any server software, you’re certainly going to want to do plenty of tinkering with the settings.

An unconfigured phpMyAdmin can also pose a potential security risk. There are a few extra steps you need to take to lock down your system.

If you ever need to restore a backup of your database, you can always use phpMyAdmin to import a new SQL file. Always make frequent backups before doing any significant modifications to the database or its settings, especially if you’re not just working on a test server.

How to Run SQL Queries

Now that you have phpMyAdmin working, you should know how to do what it’s made for: running SQL queries.

You can run queries either on the homepage (this will apply to the entire site), or in a specific database or table. Click the SQL tab at the top of the screen, type in your command, and press Go.

Running a SQL query in phpMyAdmin.
Running a SQL query in phpMyAdmin.

Here’s a list of common SQL queries:

  • Select: The most important tag, used at the beginning of almost every query.
  • Create Table: Create a new table.
  • Alter Table: Add new columns.
  • Insert: Add new rows.
  • Delete: Remove columns.
  • Update: Edit values in a table.
  • Sum(): Adds up all the values.
  • Avg(): Average the values.
  • Count(): Counts the number of filled columns.
  • Round(): Rounds the value to the integer you set.
  • Max(): Return the largest value.
  • Min(): Return the smallest value.
  • Between: Select columns within a specific range.
  • Group By: Group tables by data.
  • Order By: Order results in a certain way.

There are certainly more commands to learn, but those are a few to start with.

How to Change the Default phpMyAdmin URL

Leaving the phpMyAdmin access link on its default setting (http://website.com/phpMyAdmin) can pose a security risk.

If you make this page easy to find, hackers will be able to visit it and attempt to brute force down your username and password. It can be even worse if you’ve left the credentials on the default “root” and “password.”

But by changing the URL to something only you know, you can make it much more difficult for unknown users to access this page and try to guess the password.

Open phpMyAdmin.conf in a text editor, which you can find under C:\wamp\alias on Windows/WAMP, xampp\apache\conf\extra on XAMPP, /etc/httpd/conf.d on Linux, or /usr/conf/extra on Mac.

You should see this line in there:

Alias /phpMyAdmin /usr/share/phpMyAdmin

Change the /phpMyAdmin path to the new address of your choice. For instance:

Alias /exampleURL /usr/share/phpMyAdmin

Now you can access this unique URL for phpMyAdmin by visiting the custom address you set (http://website.com/exampleURL).

How to Set Up an NGINX Authentication Gateway

Another option is to set up a second layer of security with an authentication gateway. After moving the phpMyAdmin login page to a secret location, you can password protect this page to make it even less likely for attackers to get through.

Users of Linux on an NGINX server can run the following commands in the command line to create an authentication gateway (this is also possible on Apache servers).

Start by creating an encrypted password (change “example” to whatever you like) and noting down the result:

openssl passwd example

Create a configuration file in NGINX’s folder and give it a name:

sudo nano /etc/nginx/examplename

Enter the username and password into this file like this, being careful to leave in the colon:

exampleusername:examplepassword

Now open the NGINX configuration file.

sudo nano /etc/nginx/sites-available/default

Within the “server” block, we’ll add our gateway by pasting the following code (make sure to change the values).

location /example {
  auth_basic "Login";
  auth_basic_user_file /etc/nginx/examplename;

The first /example should be whatever you set your phpMyAdmin URL to, and you can adjust the auth_basic variable name to anything you want, and the final /examplename should be the name of the password file you created earlier.

Now upon login, you should be required to enter the credentials you set before even seeing the phpMyAdmin login.

Adminer: A Simpler Alternative to phpMyAdmin

Adminer is a free, open source database management tool similar to phpMyAdmin. Formerly called phpMinAdmin, Adminer was explicitly designed as a simpler, better alternative to phpMyAdmin.

It’s effortless to deploy on any web server. All it takes is uploading a single, lightweight PHP file.

Exploring a WordPress database with Adminer.
Exploring a WordPress database with Adminer.

Even DevKinsta, Kinsta’s free suite of local development tools, uses Adminer to run its database manager. It supports many powerful database management features such as easy database switching, viewing and editing tables, manipulating database values, importing and exporting databases, running SQL queries, and much more.

DevKinsta’s database manager is a prettier Adminer.
Adminer powers DevKinsta’s database manager.

You can learn more about Adminer, its features, and how to use it in our dedicated Adminer article.

Summary

Your first time using phpMyAdmin can be intimidating. But once you know how to install and configure it, accessing your database will be as easy as logging into WordPress.

Windows, Mac, and Linux users alike can all make use of this invaluable database manager. As long as you have a web server with PHP installed, getting it running should be simple if you follow our instructions. Remember to configure it properly and make sure it’s secure, and you’ll never have trouble modifying your database again.

Salman Ravoof

Salman Ravoof is a self-taught web developer, writer, creator, and a huge admirer of Free and Open Source Software (FOSS). Besides tech, he's excited by science, philosophy, photography, arts, cats, and food. Learn more about him on his website, and connect with Salman on Twitter.