PhpMyAdmin is a web-based tool that provides a user interface for managing MariaDB databases. It is a widely used tool to help web developers to manage MariaDB databases.
Here are some functionalities that is offered by phpMyAdmin:
- Perform operations such as creating, browsing, editing, and dropping databases, tables, views, columns, and indexes.
- Display multiple result sets using stored procedures or queries.
- Execute tasks such as creating, copying, dropping, renaming, and altering databases, tables, columns, and indexes.
- Maintain the server, databases, and tables with suggestions for server configuration.
- Load text files into tables.
Prerequisites:
Make sure that you have root access to your CentOS 7 server, Apache, PHP and MariaDB are already installed and running on your system. If not, follow these steps to install Apache, PHP and MariaDB:
Step 1. Run the following command to install Apache:
#yum install httpd
Step 2. Start Apache by running the following command:
#systemctl start httpd
Step 3. Enable Apache service to start on boot:
#systemctl enable httpd
Step 4. Install MariaDB by running the following command:
#yum install mariadb-server mariadb
Step 5. Start MariaDB by running the following command:
#systemctl start mariadb
Step 6. Enable the MariaDB service to start on boot by running the following command:
#systemctl enable mariadb
Step 7. Run the following command to Install PHP
#sudo yum install php php-mysql
Steps to install phpMyAdmin on CentOS 7 server.
To install phpMyAdmin on CentOS 7, follow these steps:
Step 1. Run the following command to install the phpMyAdmin package:
#yum install phpmyadmin
Note: If you receive the error "No package phpmyadmin available", You will have to add a repository that contains the phpMyAdmin package.You can do this by downloading the EPEL (Extra Packages for Enterprise Linux) repository using the following command:
#sudo yum install epel-release
Step 2. After the phpmyadmin installation is completed, you need to configure phpMyAdmin to work with your MariaDB server. Follow these steps:
Open the phpMyAdmin configuration file in your favorite text editor.
#nano /etc/httpd/conf.d/phpMyAdmin.conf or
#vi /etc/httpd/conf.d/phpMyAdmin.conf
In phpMyAdmin.conf file, you will see 4 different require IP strings with IP address 127.0.0.1. Replace this default value with the IP of the computer you use to access phpMyAdmin. You can check your IP using tools like mydns.is.
Press Escape and type :wq to save the file and exit.
Below is an example of a phpMyAdmin.conf file.
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.3.150
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 192.168.3.150
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.3.150
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 192.168.3.150
Allow from ::1
</IfModule>
</Directory>
In last step, restart the Apache web server by running the following command:
#systemctl restart httpd
You have successfully installed phpMyAdmin on the server. To access phpMyAdmin, enter the IP address of your CentOS 7 server with "/phpmyadmin" in your web browser.
For example, if the IP address of your CentOS 7 server is 192.168.3.103, type "http://192.168.3.103/phpmyadmin" in your web browser.
To log in to phpMyAdmin, you will need to enter your MariaDB server username and password when prompted. Once logged in, you can use the phpMyAdmin user interface to manage your MariaDB databases.
This article has covered the installation and configuration of phpMyAdmin on CentOS 7.