Install MySQL / MariaDB Server with PhpMyAdmin Centos 8

Install MySQL / MariaDB Server with PhpMyAdmin Centos 8

Install PHP, MySQL support package for PHP, and other PHP packages on your system for phpMyAdmin

to connect with the database.

dnf install -y wget php php-pdo php-pecl-zip php-json php-common php-fpm php-mbstring 
php-cli php-mysqlnd php-xml tar

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

dnf install -y php-json php-mbstring

Install phpMyAdmin

phpMyAdmin package is not yet available in the OS repository for CentOS 8 / RHEL 8. So, we need to download it from theĀ official website.

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

Install phpMyAdmin using the following command.

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

Move the phpMyAdmin set up to your desired location.

mv phpMyAdmin-5.1.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
vi /etc/httpd/conf.d/phpMyAdmin.conf

Copy and paste the below content to the above file.

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny> 
      Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

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 phpMyAdmin as shown below.

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

Restart the service.

systemctl restart httpd

 

Leave a Reply