Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install phpMyAdmin on CentOS 7

This guide shows you how to install phpMyAdmin on a CentOS 7 server. It needs root access, so it is for VPS and dedicated server users.

VPS and Cloud Servers2 min read9 steps3 screenshots

What is phpMyAdmin?

A database is a place where a website keeps its data, like a big filing cabinet. phpMyAdmin is a web page that lets you work with a MySQL or MariaDB database by clicking, not typing commands.

You should already have Apache, PHP and MariaDB (or MySQL) running on the server.

Tip: CentOS 7 is old software. Newer systems use a similar process, but the commands may use dnf instead of yum.

Steps

  1. Log in to your server with SSH. SSH lets you type commands on a remote computer.
  2. Install the EPEL repository. A repository is an online store of software. phpMyAdmin lives in this one.
    yum install -y epel-release
  3. Install phpMyAdmin.
    yum install -y phpmyadmin
    This also adds the PHP parts it needs.
  4. Open the phpMyAdmin Apache settings file.
    vi /etc/httpd/conf.d/phpMyAdmin.conf
  5. By default, only the server itself may open phpMyAdmin. Find the lines that say Require ip 127.0.0.1. Add one line below them with your own public IP address:
    Require ip YOUR.IP.ADDRESS.HERE
    Do the same for the older Allow from lines if your file has them. Save and close.
  6. Restart Apache so it reads the change.
    systemctl restart httpd
    Screenshot: Restart Apache so it reads the change. systemctl restart httpd
  7. If a firewall is on, allow web traffic.
    firewall-cmd --permanent --add-service=http
    firewall-cmd --reload
  8. Open a browser and go to http://YOUR-SERVER-IP/phpmyadmin.
  9. Log in with your database user name and password. The root database user works if you set a password for it.

Keep it safe

  • Allow only your own IP address, as in step 5.
  • Use strong database passwords.
  • Use HTTPS if you can, so passwords are not sent in plain view.

If you see a 404 or access error

Check that the Require ip line holds your correct IP address. Then restart Apache again.

Screenshot: Check that the Require ip line holds your correct IP address. Then restart Apache again.

Quick recap

  • phpMyAdmin is a web page for managing databases.
  • Install EPEL, then phpMyAdmin with yum.
    Screenshot: Install EPEL, then phpMyAdmin with yum.
  • Allow your IP in /etc/httpd/conf.d/phpMyAdmin.conf.
  • Restart Apache and open /phpmyadmin in your browser.