In terms of practicality, managing MySQL data on a console is not recommended. Overotodo if you handle a lot of records and tables. For this, there are many professional solutions that can get us out of the problem, however, if the project is personal or is something small, you can use PhpMyAdmin. A solution well known in Linux and that fulfills its objective in an efficient and simple way. With this in mind, I will teach you how to install the latest PhpMyAdmin on a server using CentOS 7.
PhpMyAdmin is an open source tool created with PHP to visualize and manage the data of a MySQL server in a graphical way. It has the support of a large community behind it and you can perform multiple operations on MySQL such as executing sentences, importing or exporting databases. Among other things.
So, let us start.
1. Install Apache web server and PHP
Being a web tool, the first thing we have to do is install the Apache web server. PhpMyAdmin also works with Ngnix quite efficiently. However, Apache is the easiest to use and works just as well.
So, open a terminal and run:
:~$ su :~# yum install httpd
After that, it is necessary to install PHP. Obviously, PHP is available in the official CentOS 7 repositories, the problem is that it is a very old version and PhpMyAdmin requires at least PHP 7.1. Then, you need to install a recent version of PHP.
You can install PHP 7.2 on CentOS 7 easily using the steps shown in this post.
Then, you need to install the PHP modules to work with PhpMyAdmin.
:~# yum install php php-session php-json php-hash php-ctype php-mbstring php-zip php-gd php-curl php-openssl php-xml
Next, enable and start the Apache service.
:~# systemctl enable httpd :~# systemctl start httpd
Then, enable Apache on the Firewall to allow access.
:~# firewall-cmd --add-service=http --permanent :~# firewall-cmd --reload
To test if PHP is working, create a file called test.php
on /var/www/html/
with this content:
:~# yum install nano :~# nano /var/www/html/test.php
<?php phpinfo(); ?>
So, open your web browser and go to http://SERVER_IP/test.php
.
So, Apache and PHP are working.
2. Install and configure MariaDB
The next step is to install MariaDB from the repositories. So it is pretty easy to do.
:~# yum install mariadb-server
After that, enable and start it.
:~# systemctl enable mariadb :~# systemctl start mariadb
Next, configure MariaDB using the mysql_secure_installation
script to set a root password.
:~# mysql_secure_installation
You can answer the questions that come up as you like. However, I recommend that you read them properly to establish the best configuration for your server. In this case, I will respond as follows: Y, N, Y, Y.
3. Install PhpMyAdmin
At the time of writing this post, the latest stable version of PhpMyAdmin is 4.8.5 the easiest way to install it is through the REMI repository.
So, install it.
:~# yum --enablerepo=remi install phpmyadmin
After that, open the PhpMyAdmin configuration file for apache to allow the connections to it.
:~# nano /etc/httpd/conf.d/phpMyAdmin.conf
In the IfModule mod_authz_core.c section, add
Require all granted.
Next, restart Apache.
:~#Â systemctl restart httpd
After that, open your web browser and go to http://SERVER_IP/phpmyadmin
Log in with your user and enjoy!
That’s it.
Conclusion
PhpMyAdmin is a very useful tool to manage MySQL data in a very simple way. It is free, open source and perfectly compatible with your web servers.
Please share this article in your social networks.
Nice post. Do you have a similar article for phpMyAdmin 5 installation?