How Install phpMyAdmin on AlmaLinux 8 (best Method)

In this tutorial, which is a complete and reference tutorial, we will fully discuss how to install phpMyAdmin on AlmaLinux 8.

The phpMyAdmin is a PHP web-applications that can be run under any operating system, including Windows, macOS, Linux, and BSDs. The main components that you must install before installing phpMyAdmin are PHP packages and a web server, you can be Apache, Nginx, etc.

phpMyAdmin is a free and open-source tool that enables you to manage MySQL and MariaDB databases from the web browser. The phpMyAdmin is a fully capable web application written in PHP with the main purpose to handle the administration of MySQL/MariaDB over the web. It provides a robust and user-friendly interface for managing databases, tables, database users, basic crud operations (create, read, update, delete), and so much more.


The best method to install phpMyAdmin on AlmaLinux 8 with Apache #

Prerequisites #

Before installing PHPMyAdmin, you need to have the following requisite packages installed.

  • PHP
  • Database Server(MySQL or MariaDB)
  • Apache Webserver

1. Install Apache, PHP, and MySQL #

PhpMyAdmin requires an Apache web server so that we can access it using the browser. As it is written using PHP hence that must be there on the server including MySQL Database.

If you have these three things then move forward otherwise see our tutorial- how to set up a LAMP server on AlmaLinux 8

2. Download phpMyAdmin Source Code #

The file we require to install and set up this GUI MySQL Database management is neither available in the base repo of AlmaLinux and nor in EPEL. Hence, we have to download it manually from its website. Visit the download page, right-click on the latest version and copy the link.

Change the working directory to ‘/var/www’ and download the source code of phpMyAdmin using the wget command as below.

download phpmyadmin 640x164 - How Install phpMyAdmin on AlmaLinux 8 (best Method)
Download phpMyAdmin files

3. Extract the zip and configure phpMyAdmin

Now extract the phpMyAdmin source code and you will get the new directory name as ‘phpMyAdmin-VERSION-NUMBER‘. Now rename the directory to ‘phpmyadmin‘ as below.

1. Install unzip #

dnf install unzip

2. Extract file #

unzip phpMyAdmin-*

3. Move the extracted files #

mv phpMyAdmin-*-all-languages /usr/share/phpmyadmin

4. Create #

The sample configuration file for phpMyAdmin is already there, only need to rename it:


cd /usr/share/phpmyadmin

sudo mv

5. Generate 32-bit Secret string #

Next, generate random strong and number (secret) using the openssl command below.

openssl rand -base64 32 

secretkey - How Install phpMyAdmin on AlmaLinux 8 (best Method)

Copy the generated secret to your note.

6. Edit Configuration file #

Edit the phpMyAdmin configuration ‘’ using nano editor.

sudo nano 

7. Set the blowfish_secret string and temp directory for phpMyAdmin #

In the configuration go to the following line:

$cfg[‘blowfish_secret’] = ”;

Change the value of “$cfg[‘blowfish_secret’] = ‘…..’;” with your generated secret on top as below.

$cfg[‘blowfish_secret’] = ‘yourgeneratedstring’;
phpMyAdmin configuration 640x385 - How Install phpMyAdmin on AlmaLinux 8 (best Method)
phpMyAdmin configuration

Next, scroll down to the “* Directories for saving/loading files from server” area in the same configuration file and add the following line:

$cfg[‘TempDir’] = ‘/tmp’;

Now press ‘Ctrl+x‘, type ‘y‘, and press ‘Enter‘ to save the configuration and exit.

phpMyAdmin configuration2 640x306 - How Install phpMyAdmin on AlmaLinux 8 (best Method)

8. Create a Temporary directory and assign its permission #


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

4.1 Create Apache configuration file for phpMyAdmin (less secure)

For this stage, you will be creating a new Apache/httpd configuration for phpMyAdmin. Also, you will be configuring the Apache basic authentication for additional security for phpMyAdmin.

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

Copy-paste the below-given code in it:

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     # Apache 2.4
      Require all granted

<Directory /usr/share/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
# Apache 2.4
       Require all granted

And Save the file by pressing Ctrl+X, to confirm press Y and hit the Enter key.

Now , restart Apache to load new configuration.

systemctl restart httpd.service

4.2 Create Apache configuration file for phpMyAdmin (secure) #

If you need more security to access Phpmyadmin follow this stage:

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

Copy-paste the below-given code in it:

# Alias for accessing phpmyadmin
Alias /phpmyadmin /var/www/phpmyadmin

# document root phpmyadmin
<Directory /var/www/phpmyadmin>

# Enable Basic authentication 
    AuthType Basic
    AuthName "Please Enter Your Password"
    AuthUserFile /var/www/phpmyadmin/.htpasswd
    Require valid-user

#    If you're paranoid - use this and allow a specific IP address
#    Order deny,allow
#    Deny from all
#    Allow from
#    Allow from ::1


Press ‘Ctrl+x‘, type ‘y‘, then press ‘Enter‘ to save and exit.

Run the following command to create a new apache basic authentication password. Change the user ‘mahdi‘ with your username.

htpasswd -c /usr/share/phpmyadmin/.htpasswd mahdi

Type the password for your user and repeat.

Screenshot 2021 11 25 041431 640x111 - How Install phpMyAdmin on AlmaLinux 8 (best Method)

Next, change the working directory to ‘/usr/share/phpmyadmin‘ and create a new configuration ‘.htaccess’ using nano editor


cd /usr/share/phpmyadmin
nano .htaccess

Copy and paste the following configuration.

AuthUserFile /usr/share/phpmyadmin/.htpasswd
AuthGroupFile /dev/null
AuthName "Secret"
AuthType Basic
require valid-user
<Files ~ "^.(htpasswd|htaccess)$">
    deny from all

Press ‘Ctrl+x‘, type ‘y‘, then press ‘Enter‘ to save and exit.

Next, change the ownership of the configuration file ‘.htaccess‘ and ‘.htpasswd‘ (generated with htpasswd command) to the ‘apache‘ using the following command.

chown apache:apache .htaccess .htpasswd

You need to verify the httpd configuration and make sure you have no error, then restart the httpd service to apply the new changes.


sudo apachectl configtest
sudo systemctl restart httpd


5. Set proper permission for SELinux policies #

If your system has an enabled SELinux, then run the below command to set the appropriate permission for SELinux policies, so that we can access this GUI app without any limitation.

chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*


6. Access phpMyAdmin Web interface #

Open your web browser and type your server IP address following with the directory path ‘/phpmyadmin


Enter the username and password of your MySQL root user to access all the databases.

phpmyadmin login - How Install phpMyAdmin on AlmaLinux 8 (best Method)
How to Install phpMyAdmin on AlmaLinux 8

Now you will get the phpMyAdmin dashboard as below.

phpmyadmin 640x319 - How Install phpMyAdmin on AlmaLinux 8 (best Method)

On the top screenshot, you will see details of the MariaDB database server. Also, you will see the details of LAMP Stack under the ‘Web server’ section.


7. Create phpMyAdmin default Storage database #

If you have not manually created a dedicated database for phpMyadmin then as you log in, the same will be asked by the software to create.

At the bottom, you will see a message “ThephpPMyAdmin configuration storage is not completely configured, some extended features have been deactivated.” Click on the “Find out why link.

Screenshot 2021 11 25 162320 640x74 - How Install phpMyAdmin on AlmaLinux 8 (best Method)

Now, another page will open, click on the “Create” link to generate a database name ‘phpymyadmin‘ to complete the configuration storage setup.

Create a database named phpmyadmin 640x387 - How Install phpMyAdmin on AlmaLinux 8 (best Method)

That’s it, you have successfully removed the warning and have set up all the required things to manage your MySQL database graphically.

congratulations! Now the installation is completed successfully!

Powered by BetterDocs