Install PhpMyAdmin On CentOS 8

Install PhpMyAdmin On CentOS 8

PhpMyAdmin is a graphical utility for managing databases. It’s typically used to remotely manage MySQL or MariaDB databases.

phpMyAdmin : What is phpMyAdmin?

Prerequisites

  • Server with CentOS 8 Linux Installed
  • Working MySQL or MariaDB database
  • Terminal window / command line (Search > terminal)
  • User account with sudo or root privileges

The phpMyAdmin tool is not included in the default CentOS 8 repositories. However, the file can be download manually.

Step 1: Install phpMyAdmin on CentOS 8

1. In a terminal window, enter the following command to download the phpMyAdmin file:

wget https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.zip

2. Extract the .zip file archive:

unzip phpMyAdmin-4.9.4-all-languages.zip

3. Move the extracted files to the /usr/share/phpmyadmin directory:

sudo mv phpMyAdmin-4.9.4-all-languages.zip /usr/share/phpmyadmin

4. Change directories:

cd /usr/share/phpmyadmin

5. Rename the sample php configuration file:

sudo mv config.sample.inc.php config.inc.php

6. Open the php configuration file for editing:

sudo nano config.inc.php

7. Find the following line:

$cfg['blowfish_secret'] = '';

8. Edit the line and enter the new php root password between the single-quotes, as follows:

$cfg[‘blowfish_secret’]=’my_password’;

9. Save the file (Ctrl+o) and close (Ctrl+x).

10. Next, create and set permissions on a temporary phpMyAdmin directory:

mkdir /usr/share/phpmyadmin/tmp
chown -R apache:apache /usr/share/phpmyadmin
chmod 777 /usr/share/phpmyadmin/tmp

 

Step 2: Configure Apache for phpMyAdmin

1. Create an Apache configuration file:

sudo nano /etc/httpd/conf.d/phpmyadmin.conf

2. This creates a new, blank configuration file. Enter the following code:

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>

3. Save the file (Ctrl+o) and exit (Ctrl+x).

4. Finally, restart the Apache service to apply the changes made in the configuration file:

systemctl restart httpd