Install phpMyAdmin in combination with LEMP in centos 7

PhpMyAdmin is a free and open source tool written in PHP for administering MySQL through a web browser. It can perform many tasks such as creating, modifying or deleting databases, tables, fields or records; perform SQL statements or manage users and grant access to the database.

In this article, BKNS will guide you to install phpMyAdmin with LEMP on CentOS 7

1. Request

VPS uses CentOS operating system and has Nginx, PHP, and MariaDB (LEMP) installed.

2. Install phpMyAdmin.

2.1. Install EPEL repository

yum install -y epel-release

2.2. After enabling the EPEL repo, install phpMyAdmin and all additional packages with the following command:

sudo yum install phpmyadmin

2.3. Create config file for phpMyadmin in nginx:

mv /etc/nginx/conf.d/default.conf mv /etc/nginx/conf.d/default.conf.bakĀ 

vi /etc/nginx/conf.d/phpMyAdmin.conf

server {
listen 80 default_server;
server_name ip_server;
root /usr/share/;

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

location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/$fastcgi_script_name;

ln -s /usr/share/phpMyAdmin/ /usr/share/nginx/

chown -R nginx:nginx /usr/share/phpMyAdmin/

chown nginx:nginx /etc/php-fpm.d/www.conf

cp /usr/share/phpMyAdmin/ /usr/share/phpMyAdmin/

2.4. Restart Nginx and php-fpm services.

service nginx restart

systemctl restart php-fpm

3. Follow the path: http://ip_server/phpMyAdmin/ to check.

Good luck!


Categorized as Email

By Nguyen Manh Cuong

Nguyen Manh Cuong is the author and founder of the nguyendiep blog. With over 14 years of experience in Online Marketing, he now runs a number of successful websites, and occasionally shares his experience & knowledge on this blog.

Leave a comment

Your email address will not be published. Required fields are marked *