How to install phpMyAdmin on CentOS

Reference Server

In this tutorial we will learn to install phpMyAdmin on CentOS server.

What is phpMyAdmin?

phpMyAdmin is an open-source and free tool written in php to access and manage MySQL and MariaDB from a web browser.

Requirement

  • CentOS server
  • Apache Web Server 2.4
  • MySQL or MariaDB
  • Php 5.4

So, lets get started with the installation process...

Step 1: Clean up and update yum

Its a best practice to first clean up and update yum and then perform installation.

Clean up yum by typing the following in terminal.

# sudo yum clean all

Now perform the update

# sudo yum -y update

Step 2: Install EPEL Repository

EPEL (Extra Packages for Enterprise Linux) contains the many packages for CentOS including phpMyAdmin. So use the following command to install epel.

# sudo yum install epel-release

Step 3: Install phpMyAdmin

Use the following command to install phpMyAdmin.

# sudo yum install phpmyadmin

Step 4: Setting up

After phpMyAdmin installation is complete open /etc/httpd/conf.d/phpMyAdmin.conf file and make the following changes

Open the file using vi

# sudo vi /etc/httpd/conf.d/phpMyAdmin.conf

Switch to INSERT mode by pressing i key and comment out the lines using #.

#Apache 2.4
# Require ip 127.0.0.1
# Require ip ::1
Require all granted

The file content will look like the following.


<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

Once you are done with the changes press ESC key to exit INSERT mode. Save the file using the :wq command.

Now restart Apache using the following command.

# sudo systemctl restart httpd

Step 5: Open phpMyAdmin

To open phpMyAdmin in the browser go to your server ip address or your domain name and type in phpmyadmin.

http://your_server_ip_address/phpmyadmin

Or,

http://www.example.com/phpmyadmin

If configuration was properly done then you will see the following screen.

Login using the database username and password and you will see the following screen.

Conclusion

Congrats! you have installed phpMyAdmin successfully. Have fun coding!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT