Use phpMyAdmin on a Linux server to manage your MySQL or MariaDB databases easily through a web-based graphical interface. phpMyAdmin simplifies database administration tasks such as creating, modifying, and deleting databases and tables without needing to use complex command-line tools.

This guide explains how to install, configure, and secure phpMyAdmin on a Linux server with popular distributions like Ubuntu, Debian, CentOS, or Red Hat.
Prerequisites
- A Linux server running Ubuntu, Debian, CentOS, Red Hat, or similar
- Root or sudo access for installing and configuring software
- An Apache web server is installed and running
- MySQL or MariaDB server installed and running
- Basic familiarity with terminal commands
Use phpMyAdmin on a Linux Server
phpMyAdmin is a popular, open-source web-based tool that allows you to manage MySQL or MariaDB databases through an intuitive graphical interface. Using phpMyAdmin on a Linux server simplifies database administration tasks like running SQL queries, managing users, importing/exporting data, and backing up databases—all from your browser. It’s ideal for developers and sysadmins who want a convenient, user-friendly way to handle database operations without using the command line.
Install phpMyAdmin on the Linux Server
To begin using phpMyAdmin, you need to install phpMyAdmin on your Linux server. The installation process involves downloading the package and configuring it to work with your existing web server and database system, typically Apache with MySQL or MariaDB.
- Ubuntu/Debian Systems
Update your package list and install phpMyAdmin along with the required PHP extensions:
sudo apt update
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl -y
During installation, you will be prompted to:
- Choose the web server to configure automatically — select apache2 using the spacebar, then Tab to OK, and hit Enter
- Confirm if you want to configure the database with dbconfig-common — select Yes
- Set a password for the phpMyAdmin application database user, or leave blank to auto-generate
After installation, enable the PHP mbstring module and restart Apache:
sudo phpenmod mbstring
sudo systemctl restart apache2
- CentOS/Red Hat Systems
First, enable the EPEL repository (if not already enabled):
sudo yum install epel-release -y
sudo yum update -y
Install phpMyAdmin and the necessary PHP modules:
sudo yum install phpmyadmin php-mbstring php-zip php-gd php-json php-curl httpd mariadb-server -y
Enable and start Apache and MariaDB services if not running:
sudo systemctl enable --now httpd mariadb
Configure phpMyAdmin on a Linux Server
After installing phpMyAdmin, proper configuration ensures secure and seamless access to your databases. You’ll typically need to adjust the configuration file to define authentication settings, manage user permissions, and restrict access by IP if desired. This step is crucial for aligning phpMyAdmin with your web server setup and securing it from unauthorized access. By default, phpMyAdmin’s configuration file is located at:
- Ubuntu/Debian:
/etc/phpmyadmin/config.inc.php
- CentOS/Red Hat:
/etc/httpd/conf.d/phpMyAdmin.conf
Secure Apache Access (Important)
For CentOS/Red Hat users, restrict phpMyAdmin access in the Apache config to allow only trusted IPs or localhost. For example, edit /etc/httpd/conf.d/phpMyAdmin.conf
:
<Directory /usr/share/phpMyAdmin/>
Require ip 127.0.0.1
Require ip your_trusted_ip_here
</Directory>
Restart Apache to apply changes:
sudo systemctl restart apache2 # or sudo systemctl restart httpd
Access phpMyAdmin on the Linux Server
Open a web browser and navigate to:
http://your_server_ip/phpmyadmin
Log in with your MySQL or MariaDB user credentials. For many setups, root login via phpMyAdmin is disabled by default for security — create a dedicated database user with limited privileges for regular use.
Securing phpMyAdmin
Securing phpMyAdmin is essential to protect your database management interface from unauthorized access and attacks. Start by limiting access to trusted IPs or enabling HTTP authentication at the web server level. Always serve phpMyAdmin over HTTPS to encrypt login credentials and session data.
Avoid using root credentials—create dedicated database users with limited privileges. Lastly, keep phpMyAdmin and your server packages updated to patch known vulnerabilities and enhance overall security.
- Restrict access by IP address or enable authentication using the web server layer (e.g., HTTP basic auth).
- Use HTTPS to encrypt traffic by configuring SSL/TLS on your Apache server.
- Avoid using the root database user for daily phpMyAdmin access — create limited permission users instead.
- Regularly update phpMyAdmin and your underlying systems for security patches.
Troubleshooting and Useful Commands
- Restart the web server after configuration changes:
sudo systemctl restart apache2 # Ubuntu/Debian
sudo systemctl restart httpd # CentOS/Red Hat
- Check Apache error logs if phpMyAdmin is not accessible:
sudo tail -f /var/log/apache2/error.log # Ubuntu/Debian
sudo tail -f /var/log/httpd/error_log # CentOS/Red Hat
- Verify MySQL/MariaDB service is running:
sudo systemctl status mysql # Ubuntu/Debian MySQL
sudo systemctl status mariadb # CentOS/Red Hat MariaDB
Conclusion
To use phpMyAdmin on a Linux server, install the phpMyAdmin package and required PHP extensions, configure your web server (commonly Apache), and secure access to the tool. phpMyAdmin provides an intuitive graphical interface for managing your MySQL and MariaDB databases, making it ideal for beginners and database administrators alike.
Always secure your installation by limiting access, using SSL, and creating dedicated database users for web management. For comprehensive installation details, configurations, and security best practices, visit the official phpMyAdmin documentation.