PhpMyAdmin is open source software used primarily for managing MySQL/MariaDB via a browser
If you have MariaDB server installed on your CentOS 7 Linux server, the only way to manage the database is through the Command Line Interface (CLI).
PhpMyAdmin provides an interactive GUI environment that you can use to create databases, tables and even running queries right from a browser Window.
In this guide, we will focus on the steps that you need to follow to install phpMyAdmin on your CentOS 7 server.
- A VPS plan running Centos 7 Server
- A non-root user with sudo privileges
- MySQL server
- Apache web server>
<li">PHP scripting language
Step 1: First update your system
In order to ensure that we have updated system software and dependencies, we need to run the command below:
$ sudo yum update
Type Y and hit Enter when prompted to install the updates.
This will ensure that our Centos 7 server has the latest security and general package updates
Step 2: Check Whether MySQL or MariaDB is Working
First, make sure that MySQL/MariaDB server is installed on your system.
Special Note: you can find the best MySQL hosting services here on HostAdvice.
You can run any of the commands below:
$ systemctl status mariadb
$ systemctl status mysql
You should see an ‘Active’ status in green if any of the services is running.
In case you don’t have the database server on your system, you can run the command below to install MariaDB server.
$ sudo yum install mariadb-server mariadb
$ sudo systemctl start mariadb
To ensure that our MariaDB server will start at boot, we need to run the command below:
$ sudo systemctl enable mariadb
Since a default MariaDB server installation is not secure, we can run the command below to secure it:
This will assist us in setting a root password and remove anonymous users and test databases.
Step 3: Install phpMyAdmin
Now that we have verified that MySQL/MariaDB server is up and running, we need to install phpMyAdmin. We can do this by running the command below.
$ sudo yum install phpMyAdmin
Type Y and Enter to confirm the installation
Next, we need to edit the phpMyAdmin configuration file using a nano editor:
$ sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
We need to add ‘Require All granted’ value just under the ‘/usr/share/phpMyAdmin/’ directory
So, the final file excerpt should look like the one below. The change required is highlighted in red:
... <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> ...
$ sudo systemctl restart httpd
Step 4: Test the installation
You can now visit the address below on your web browser to test the installation
If the installation succeeded, you should see the below phpMyAdmin login page. Just enter your username and password and click ‘Go’ to login
That’s all when it comes to installing phpMyAdmin on your Centos 7 server. Remember, you need to log in with your root password if you haven’t added any user on your MariaDB/MySQL database. Once you logged in, you will be able to manage your database and run MySQL queries from an intuitive interface that is far much easier than using the MySQL command line interface.