Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the js_composer domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/holhol2/public_html/wp-includes/functions.php on line 6121

How To Install phpMyAdmin with Nginx on CentOS 8 / RHEL 8 – Holhol24

By holhol24 | June 25, 2019
How To Install phpMyAdmin with Nginx on CentOS 8 / RHEL 8 - ITzGeek

phpMyAdmin is a free and open-source, web-based administration tool for managing the MySQL and MariaDB servers. It is widely used to manage database servers by web hosting companies and administrators who are new to database servers.

phpMyAdmin helps an administrator to perform database activities such as creating, deleting, querying, tables, columns, etc.

This guide will help you to install phpMyAdmin with Nginx on CentOS 8 / RHEL 8

Prerequisites

Install MySQL / MariaDB Server

To install and use phpMyAdmin, you must have one database instance running on your system and the Nginx web server.

Standalone Database

Follow the tutorials and prepare your system for installing phpMyAdmin.

READ: How To Install MariaDB on CentOS 8 / RHEL 8

OR

READ: How To Install MySQL on CentOS 8 / RHEL 8

AND

READ: How To Install LEMP Stack on CentOS 8 / RHEL 8

You can skip the database part in the LEMP stack tutorial if your system already has MariaDB/MySQL database.

Install below PHP extensions for phpMyAdmin to connect with the database.

yum install -y php-json php-mbstring

LEMP Stack

READ: How To Install LEMP Stack on CentOS 8 / RHEL 8

Install below PHP extensions for phpMyAdmin to connect with the database.

yum install -y php-json php-mbstring

Install phpMyAdmin

The phpMyAdmin is not available as an RPM package in OS repositories for CentOS 8 / RHEL 8. So, we will download the tarball from the official website.

wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz

Install phpMyAdmin using the following command.

tar -zxvf phpMyAdmin-4.9.0.1-all-languages.tar.gz

Move the phpMyAdmin directory to your desired location.

mv phpMyAdmin-4.9.0.1-all-languages /usr/share/phpMyAdmin

Configure phpMyAdmin

Copy the sample configuration file.

cp -pr /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

Edit the configuration file and add the blowfish secret.

vi /usr/share/phpMyAdmin/config.inc.php

Generate blowfish secret and update the secret in the below line.

$cfg['blowfish_secret'] = 'bo95yavJ;V,1PzSlxyFwtyMJ}WmG98-6'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Import the create_tables.sql to create new tables for phpMyAdmin.

mysql < /usr/share/phpMyAdmin/sql/create_tables.sql -u root -p

Create a virtual host file for phpMyAdmin (Ex. phpMyAdmin.conf) under /etc/nginx/conf.d directory.

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

Paste the following content into the above file. Change the domain name as per your requirement.

server {
   listen 80;
   server_name pma.holhol24.local;
   root /usr/share/phpMyAdmin;

   location / {
      index index.php;
   }

## Images and static content is treated different
   location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log off;
      expires 30d;
   }

   location ~ /.ht {
      deny all;
   }

   location ~ /(libraries|setup/frames|setup/libs) {
      deny all;
      return 404;
   }

   location ~ .php$ {
      include /etc/nginx/fastcgi_params;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
   }
}

Create a tmp directory for phpMyAdmin and change the permission.

mkdir /usr/share/phpMyAdmin/tmp

chmod 777 /usr/share/phpMyAdmin/tmp

Set the ownership of the phpMyAdmin directory, as shown below.

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

Restart the services.

systemctl restart nginx 

systemctl restart php-fpm

Firewall

Add a firewall rule to allow HTTP requests from the external network.

firewall-cmd --permanent --add-service=http

firewall-cmd --reload

Access phpMyAdmin

Access the phpMyAdmin using the browser by going to the below URL.

http://your-fully-qualified-domain-name

Log in as the DB root or a regular database user.

Install phpMyAdmin with Nginx on RHEL 8 – phpMyAdmin Login Page
Install phpMyAdmin with Nginx on RHEL 8 – phpMyAdmin Login Page

You will get the home page where you can manage databases.

Install phpMyAdmin with Nginx on RHEL 8 - phpMyAdmin Main Page
Install phpMyAdmin with Nginx on RHEL 8 – phpMyAdmin Main Page

Conclusion

I hope this post helped you to install phpMyAdmin with Nginx on CentOS 8 / RHEL 8. Please share your feedback in the comments section.

holhol24

I am a Linux server pro admin and enthusiast, an upcoming web developer, junior php developer. I am currently a content creator for Holhol24, I love to play with Linux and all other distributions of it. I loves working with computers and strongly believes in sharing knowledge. Follow me For more insight into what is happening in Tech.

Advertisement Share: Facebook Twitter WhatsApp

Deprecated: File Theme without comments.php is deprecated since version 3.0.0 with no alternative available. Please include a comments.php template in your theme. in /home/holhol2/public_html/wp-includes/functions.php on line 6121

Leave a Reply

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