phpMyAdmin is web-based client written in PHP programming language for managing MySQL databases. It provides a user-friendly web interface to access and manage your databases. This article will help you to install phpMyAdmin on CentOS, RHEL, Fedora, Ubuntu, Debian, and other Linux operating systems. Before installing PHPMyAdmin make sure that you have Apache, PHP, and MySQL installed on the server. If you do not have them read our tutorials on how to install them.

  • Setup LAMP Stack on CentOS and Redhat
  • Setup LAMP Stack on Ubuntu

Step 1 – Download phpMyAdmin Archive

Download latest phpMyAdmin source code and extract on your system using. Click here to download latest or any older release of phpMyAdmin. Also extract the downloaded archive. The latest version of phpMyAdmin is compatible with PHP >= 7.1 and MySQL/MariaDB >= 5.5 and newer.

wget https://files.phpmyadmin.net/phpMyAdmin/5.1.3/phpMyAdmin-5.1.3-all-languages.zip 
unzip phpMyAdmin-5.1.3-all-languages.zip 
mv phpMyAdmin-5.1.3-all-languages /usr/share/phpmyadmin 

Now set the proper permissions on files to be used with the webserver. Generally, the Apache webserver runs under a user and group named www-data on Debian-based systems and apache on Redhat-based systems.

### Debian based system 
chown -R www-data:www-data /usr/share/phpmyadmin 
chmod -R 755 /usr/share/phpmyadmin 

### Redhat based system 
chown -R apache:apache /usr/share/phpmyadmin 
chmod -R 755 /usr/share/phpmyadmin 

Step 2 – Setup Apache for phpMyAdmin

Create a new Apache configuration file for phpMyAdmin /etc/httpd/conf.d/phpmyadmin.conf for RedHat based system and /etc/apache2/conf-available/phpmyadmin.conf for Debian based systems and add following settings there.

<Directory "/usr/share/phpmyadmin">
  Order Deny,Allow
  Deny from all
  Allow from localhost
  Allow from 127.0.0.1
  Allow from 192.168.1.0/24
</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin

Change 192.168.1.0/24 with your LAN subnet IP addresses.

Step 3 – Restart Apache Service

After creating a configuration file we need to restart or reload the Apache service. I prefer to just reload on production servers.

sudo service httpd reload            ## RedHat based systems 
sudo service apache2 reload          ## Debian based systems 

Step 4 – Access phpMyAdmin

Now you can access phpMyAdmin in a browser using the following URL. Change localhost with your server’s IP or hostname.

URL: http://localhost/phpMyAdmin/
Login Details: Use MySQL username and password.

Install latest phpMyAdmin using Source Code

Congratulation’s You have successfully installed phpMyAdmin.