phpMyAdmin is a web-based tool that provides a graphical interface for managing MySQL and MariaDB databases. This guide walks you through installing phpMyAdmin on CentOS 7, enabling you to manage databases through your browser instead of the command line. The installation requires setting up Apache, configuring the EPEL repository, and adjusting access permissions.

Background

phpMyAdmin is essential for users who prefer not to work with the MySQL command line interface. It supports a wide range of database operations including table management, user administration, and direct SQL statement execution. The tool has been translated into 72 languages and supports both LTR and RTL text directions.

Key Features

  • Display multiple result sets from stored procedures and queries
  • Create, browse, edit, and drop tables, databases, columns, views, and indexes
  • Copy, rename, and alter database structures
  • Server maintenance with configuration suggestions
  • Upload text files into tables

How to Install phpMyAdmin on CentOS 7

  1. Step 1: Connect to Your VPS

    Connect your PC to the VPS server via SSH before beginning the installation.

  2. Step 2: Install Apache Web Server

    Install the Apache web server using the following command:

    yum install httpd -y

    Check Apache status:

    systemctl status httpd

    Verify Apache is working by navigating to your server's IP address in a web browser. You should see the Apache test page.

    Apache testing splash screen

  3. Step 3: Install the EPEL Repository

    phpMyAdmin is available in the EPEL repository (Extra Packages for Enterprise Linux). Install the epel-release package to access EPEL:

    sudo yum install epel-release
  4. Step 4: Install phpMyAdmin

    Run the following command to install phpMyAdmin:

    sudo yum install phpmyadmin
  5. Step 5: Configure phpMyAdmin Access

    Edit the phpMyAdmin configuration file to enable remote access. Open the file using vim:

    vim /etc/httpd/conf.d/phpMyAdmin.conf

    Find the four instances of Require ip strings. The default value is 127.0.0.1. Change this to the IP address of the machine you will use to access phpMyAdmin (e.g., 192.168.xxx.yyy). You can check your IP using a tool like WhatsMyIP.

    phpMyAdmin configuration file

    Press Esc and type :wq to save and exit the file.

  6. Step 6: Restart Apache

    Restart the Apache web server to apply the configuration changes:

    systemctl restart httpd
  7. Step 7: Access phpMyAdmin

    Open your web browser and navigate to your server's IP address followed by /phpmyadmin:

    http://your-server-ip/phpmyadmin

    You will see the phpMyAdmin login screen.

  8. Step 8: Find Your Login Credentials

    Check your username and password in the config.inc.php file located in the phpMyAdmin installation directory at /etc/phpMyAdmin. Open the file with vim:

    vim /etc/phpMyAdmin/config.inc.php

    Locate the username and password as shown in the configuration file.

    phpMyAdmin user configuration file

    Press Esc and type :wq to save and exit.

Conclusion

You have successfully installed phpMyAdmin on CentOS 7. Once logged in, you'll see a user-friendly dashboard for managing your MySQL or MariaDB databases. phpMyAdmin requires no database administration experience and provides an intuitive solution for common database tasks.