PhpMyAdmin Install and Configure with Nginx on CentOS 7

In this Linux How to’s tutorial we will install and configure the latest version of phpMyAdmin 4.4.9 to handle the database administration of MySQL, MariaDB and Drizzle servers over the web. It’s the best web based administration tool mainly for the beginner’s and for those who don’t feels comfortable with the command line administration. Its written in php so provides the intuitive web interface and supports most of the MySQL features to create and drop databases, create/drop/alter tables, delete/edit/add columns, execute any SQL statement and to manage indexes on columns.

Base Environment

We are going to install phpMyAdmin version 4.4.9 on the basic environment of Linux operating system with Nginx web server using MySQL’s Maria DB database and PHP. So, before starting the installation and configurations of phpMyAdmin make sure that you had already setup the LEMP Stack.

LEMP Stack Status

Check the status of Prerequisites that their services are enabled and running as we are going to install phpMyAdmin 4.4.9 under the following LEMP stack environment.


[root@CentOS-7 ~]# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)


[root@CentOS-7 ~]# nginx -v
nginx version: nginx/1.8.0


[root@CentOS-7 ~]# mysql -V
mysql Ver 15.1 Distrib 5.5.41-MariaDB, for Linux (x86_64) using readline 5.1


[root@CentOS-7 html]# php-fpm -v
PHP 5.4.16 (fpm-fcgi) (built: Oct 31 2014 13:01:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Start phpMyAdmin 4.4.9 Installation:

After we had confirmed that our basic environment to setup phpMyAdmin installation is fine, let's proceed with the following steps to setup phpMyAdmin.

STEP 1: Download phpMyAdmin 4.4.9 Package

Many operating systems already includes with its package but unfortunately in CentOs 7.1 its not available by default in its repositories. So we can install it with two different methods, one is to enable the EPEL repository first and then install it using following YUM commands.

[root@CentOS-7 ~]#yum install epel-release
[root@CentOS-7 ~]#yum install phpmyadmin

The second method is to download the latest release from its official web link.
So, we will follow the second method to download the latest release of phpMyAdmin 4.4.9 in tar.gz package.

[root@CentOS-7 tmp]# wget

STEP 2: Extract phpMyAdmin 4.4.9 Package

We will extract this .tar.gz package into the document root directory of Nginx to create its virtual host after that.

[root@CentOS-7 tmp]# tar zxvf phpMyAdmin-4.4.9-all-languages.tar.gz –C /usr/share/nginx/html/
[root@CentOS-7 tmp]# ls /usr/share/nginx/html/

Now change its name to a user friendly name with MV command. Let's move html directory first and change its name as.

[root@CentOS-7 tmp]# cd /usr/share/nginx/html/
[root@CentOS-7 html]# vm phpMyAdmin-4.4.9-all-languages phpMyAdmin
[root@CentOS-7 html]#ls
[root@CentOS-7 html]#phpMyAdmin

STEP 3: Configure phpMyAdmin Virtual Host

In order to access phpMyAdmin over the web we need to configure its virtual host. Create an new file within the default configuration directory of Nginx.

[root@CentOS-7 ~]# cd /etc/nginx/conf.d/
[root@CentOS-7 conf.d]# touch vitual.conf
[root@CentOS-7 conf.d]# vim virtual.conf
server {
root /usr/share/nginx/html/;

location / {
index index.html index.htm index.php;

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;

Web Configurations of phpMyAdmin

Before we go to web access of phpMyAdmin, open its document root directory and rename or copy its configuration file to configure it as per requirements.

[root@CentOS-7 html]# cd /usr/share/nginx/html/phpMyAdmin/
[root@CentOS-7 phpMyAdmin]# cp

Now we can access the phpMyAdmin Web Administration console after restart of Nginx and php-fpm services with following commands.

[root@CentOS-7 phpMyAdmin]# systemctl restart nginx.service
[root@CentOS-7 phpMyAdmin]# systemctl restart php-fpm.service

after getting services active status we are now ready to open our web browser to access phpMyAdmin Web Console and login with the root credentials of our MySQL Maria-DB Server.
phpMyAdmin Login

phpMyAdmin Missing Configurations

There are few missing configurations on the home page of phpMyAdmin Administration panel that we need to configure by making changes to the configuration file of phpMyAdmin. Let's follow the two steps to complete these two missing configurations.

phpMyAdmin Missing Conf

STEP 1: Add blowfish_secret passphrase

If you see the following error message at the bottom of your phpMyAdmin home page after your first login, then its means its missing Blowfish passowrd.

Blowfish Password

To figure out this problem just Open the configurations file of phpMyAdmin and add the encrypted password in front of blowfish_secret.

[root@CentOS-7 phpMyAdmin]# vim
$cfg['blowfish_secret'] = '5v}wtr0gDKnqOSDd8}nwzuoksuszpZNdLI-}2KE~n'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

STEP 2: Enabling Configuration Storage

This configuration is optional and should be disappeared after a refresh of page.

phpMyAdmin Storage Missing

To recover from this error message we will uncomment below lines from the phpmyAdmin configurations file as set the control username and password.

phpmyadmin stotage configs

Creating phpMyAdmin database and user

According to above configurations now we will create a controluser and then import the database from the document root of phpMyAdmin using following commands.

To Create User

MariaDB [(none)]> create user 'pma'@'localhost' identified by 'pma123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit

To Import database

[root@CentOS-7 phpMyAdmin]# mysql -u root -p < /usr/share/nginx/html/phpMyAdmin/sql/create_tables.sql
Enter password:

Grant Privileges to Control User

To take advantage of the relational features and other bookmark, we will need to give pma control user with some additional permissions as shown.

User Privileges

Restart Services

We had done with all the setup and configurations of phpMyAdmin now to impliment these changes we have to restart nginx, mariadb and php-fpm services.

[root@CentOS-7 phpMyAdmin]#systemctl restart mariadb.service
[root@CentOS-7 phpMyAdmin]#systemctl restart nginx.service
[root@CentOS-7 phpMyAdmin]#systemctl restart php-fpm.service

Now logout from the previous session and refresh your web browser or open it in new window with same following URL. The error messages at the bottom of the main screen should now gone away.

Ready to go with phpMyAdmin Bringing MySQL to the web

phpMyadmin Home


We had successfully installed and configured phpMyAdmin with all security parameters to an awesome open source tool for the administration of databases. Its so helpful for the newbies and for the professional as it also provide us with its console option to execute queries. So, get ready to setup your own phpMyAdmin environment and feel free to comment us back.

1 thought on “PhpMyAdmin Install and Configure with Nginx on CentOS 7”... add one

Leave a Comment