Install phpMyAdmin on CentOS 7

phpMyAdmin is one of the best web interface based database management tool for MySQL. Using phpMyAdmin users can interact with the MySQL database easily. It provides the most useful functions to interact with the MySQL databases. In this tutorial, you will learn how to install phpMyAdmin on CentOS 7.

Prerequisites

1. Before you start installing phpMyAdmin on CentOS 7. You must have the non-root user account on your server with sudo privileges.

2. Make it sure that LAMP stack is installed on the server. If you have not installed it please use the following link to install LAMP: How to install LAMP stack on CentOS 7

1. Install phpMyAdmin on CentOS 7

phpMyAdmin is not available in CentOS core repositories so you will need to add EPEL reposiory by running following command

sudo yum install epel-release

Now you can install phpMyAdmin by typing following command. It will also install all the dependencies required.

sudo yum install phpmyadmin

2. Configure phpMyAdmin

As you are going to access phpMyAdmin from the remote location you will need to configure some settings. The configuration file for apache created during installation. By default, all connections are denied except localhost so you will need to modify config file and add allowed IP Addresses.

To get your IP Address enter following command in terminal.

curl ipinfo.io/ip

Enter following command to edit configuration file.

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

Replace Require ip 127.0.0.1 with Require ip YOUR_IP_ADDRESS

Example is given in following code.

# Apache 2.4
<RequireAny>
    Require ip 192.168.43.103 Require ip ::1 </RequireAny>

Now restart Apache By entering following command.

sudo systemctl restart httpd

Now you can login to phpMyAdmin by going to following link https://YOUR_DOMAIN_NAME/phpmyadmin or on your desktop http://127.0.0.1/phpmyadmin/.

NOTE : Remember you should know username and password for database. if you don’t know follow next step and create a user with permissions.

Install phpMyAdmin on CentOS - Login to phpMyAdmin
Install phpMyAdmin on CentOS – Login to phpMyAdmin

3. Create Database User (Optional)

Open MySQL shell by typing following command

sudo mysql

Create a new user by typing following command

CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';

Grant all permissions to the created user by typing

GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;

Exit MySQL shell by typing

exit;

Now you can login to phpMyAdmin by going to following link https://YOUR_DOMAIN_NAME/phpmyadmin or on your desktop http://127.0.0.1/phpmyadmin/.

Conclusion

You have successfully installed phpMyAdmin on CentOS 7. If you have any queries regarding this please don’t forget to comment below.