Set up phpMyAdmin on AlmaLinux 9 | Easy and Full Setup
In this tutorial from the Orcacore website, we want to teach you how to set up phpMyAdmin on AlmaLinux 9. phpMyAdmin is a free web application that provides a convenient GUI for working with the MySQL database management system. It is the most popular MySQL administration tool, used by millions of users worldwide, and has won numerous awards and honors.
This PHP utility has all the common functions that you may need when developing a MySQL-based application or website. It is also a reference for several similar products, for example, phpPgAdmin, which provides similar functions for the PostgreSQL DBMS.
Before you start to install phpMyAdmin on AlmaLinux 9, you need to meet some requirements first.
1. Requirements for phpMyAdmin Setup
You need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our article on the Initial Server Setup with AlmaLinux 9.
Also, you need to have the LAMP stack installed on your server. For this, you can check our article How to Install LAMP Stack on AlmaLinux 9.
When you are done with these requirements, you can follow the steps below to install phpMyAdmin on AlmaLinux 9.
2. Create a MariaDB User for phpMyAdmin
At this point, you need to log in to your MariaDB shell with the command below:
sudo mysql -u root -p
From there, use the command below to create a user:
CREATE USER '<b>newuser</b>'@'localhost' IDENTIFIED BY '<b>password</b>';
Grant all the privileges to it:
GRANT ALL PRIVILEGES ON *.* TO '<b>newuser</b>'@'localhost';
Flush the privileges and exit:
FLUSH PRIVILEGES;
Exit;
3. Install phpMyAdmin on AlmaLinux 9
Here we will install phpMyAdmin by downloading the zip file from the phpMyadmin Downloads page. Visit the page and check for the latest version, and copy the link address of the all languages zip file.
First, use the wget command to download phpMyAdmin on AlmaLinux 9:
sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
Next, you can extract your downloaded file with the command below:
sudo unzip phpMyAdmin-*-all-languages.zip
Here you need to move your extracted files to the /usr/share/phpmyadmin
directory:
sudo mv phpMyAdmin-*-all-languages /usr/share/phpmyadmin
Switch the phpMyAdmin directory on AlmaLinux 9 with the following command:
cd /usr/share/phpmyadmin
The sample configuration file for phpMyAdmin already exists in the directory. You just need to rename it with the following command:
sudo mv config.sample.inc.php config.inc.php
Also, you need to generate a secret string for the next steps. To do this, run the following command:
openssl rand -base64 32
In your output, you will see something similar to this:
<b>Output</b>
lzrkh9L2gt/iUVXAoHhAxXHss/r8CUxk793mhF6gKw4=
4. Configure phpMyAdmin on AlmaLinux 9
At this point, you need to make some configuration changes to the file that you have renamed before.
Open the file with your favorite text editor, here we use vi:
sudo vi config.inc.php
In the file, find the line below and enter the secret string that you have generated before in it:
$cfg['blowfish_secret'] = '<b>yourgeneratedstring</b>';
Next, find the ‘Directories for saving/loading files from server’ section and add the following line under this section:
$cfg['TempDir'] = '/tmp';
When you are done, save and close the file.
This temp directory that you have defined in the phpMyAdmin configuration file on AlmaLinux 9, is used to store the cache files.
Now use the following command to create it:
sudo mkdir /usr/share/phpmyadmin/tmp
Then, set the ownership and correct permissions with the commands below:
$ sudo chown -R apache:apache /usr/share/phpmyadmin
$ sudo chmod 777 /usr/share/phpmyadmin/tmp
Here, you need to create an Apache configuration file for the phpMyAdmin files on AlmaLinux 9.
Create and open the file with your favorite text editor, here we use vi:
sudo vi /etc/httpd/conf.d/phpmyadmin.conf
Add the following contents to the file:
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>
</Directory>
<Directory /usr/share/phpmyadmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
</Directory>
When you are done, save and close the file.
Restart Apache to apply the changes:
sudo systemctl restart httpd.service
5. Access the phpMyAdmin Dashboard
At this point, you can access the phpMyAdmin web interface by typing your server’s IP address in your web browser, followed by /phpmyadmin
:
http://<b>your-server-ip-address</b>/phpmyadmin
You will see the phpMyAdmin login screen. Enter your MariaDB user and password that you have created before and press the Login button to see your phpMyAdmin dashboard.


That’s it, you are done.
Conclusion
At this point, you have learned to set up phpMyAdmin on AlmaLinux 9. After ensuring PHP, Apache, and MariaDB are properly installed, phpMyAdmin can be downloaded and configured to connect to the database. With proper firewall settings and access controls in place, phpMyAdmin provides a convenient web interface for managing MySQL/MariaDB databases on AlmaLinux 9.
Hope you enjoy it. You may also like to read the following articles:
Install Python 3.13 on AlmaLinux
Almalinux 10 Release Date and Download
HAproxy Load Balancing on AlmaLinux 9
Install Ansible on AlmaLinux 9
Alternative Solutions for Managing MariaDB on AlmaLinux 9
While phpMyAdmin offers a user-friendly GUI for database management, there are alternative approaches that can be used. Here are two different ways to manage your MariaDB database on AlmaLinux 9, along with explanations and code examples. The ease to set up phpMyAdmin on AlmaLinux 9 is undeniable, but these alternatives may provide additional flexibility.
1. Using the MariaDB Command-Line Client
The most direct way to interact with a MariaDB database is through the command-line client, mysql
. This method offers precise control over database operations and doesn’t rely on a web interface. It’s especially useful for scripting and automation.
Explanation:
The mysql
client allows you to execute SQL commands directly against the MariaDB server. You can create databases, tables, users, and perform data manipulation (insert, update, delete, select) all from the terminal.
Steps:
-
Log in to the MariaDB server:
sudo mysql -u root -p
This command will prompt you for the root user’s password.
-
Execute SQL commands:
Once logged in, you can execute SQL commands. For example, to create a new database:
CREATE DATABASE mydatabase;
To create a user and grant privileges:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'securepassword'; GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost'; FLUSH PRIVILEGES;
To select database:
USE mydatabase;
To create table:
CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL, email VARCHAR(100) );
To insert data:
INSERT INTO users (username, email) VALUES ('john_doe', 'john@example.com');
To select data:
SELECT * FROM users;
-
Exit the MariaDB client:
EXIT;
Advantages:
- Direct control: Offers the most granular control over database operations.
- Scripting and automation: Easily incorporated into scripts for automated database management tasks.
- Resource-efficient: Doesn’t require a web server or GUI, minimizing resource consumption.
Disadvantages:
- Steep learning curve: Requires familiarity with SQL syntax.
- Less user-friendly: Lacks the visual aids and ease of use of a GUI.
- Error-prone: Manually typing SQL commands can lead to syntax errors.
2. Using Dbeaver (GUI Tool)
Dbeaver is a free, open-source, and universal database tool that provides a GUI for working with various databases, including MariaDB. Unlike phpMyAdmin, which is specifically designed for web-based access, Dbeaver is a desktop application offering a broader range of features and database support.
Explanation:
Dbeaver provides a more comprehensive and feature-rich GUI compared to phpMyAdmin. It allows you to connect to multiple databases simultaneously, manage schemas, browse data, execute SQL queries, and perform advanced database administration tasks.
Steps:
-
Install Dbeaver:
Download and install Dbeaver from the official website: https://dbeaver.io/
-
Configure Dbeaver:
On AlmaLinux 9, you can download the RPM package and install it. You can also use
yum
ordnf
command to install dbeaver.sudo dnf install dbeaver
-
Connect to your MariaDB database:
- Open Dbeaver.
- Click on "New Database Connection."
- Select "MariaDB" as the database type.
- Enter the connection details:
- Host: localhost (or your server’s IP address)
- Port: 3306 (default MariaDB port)
- Database: The name of your database (e.g.,
mydatabase
) - Username: The username you created (e.g.,
myuser
) - Password: The password for the user.
- Click "Test Connection" to verify the connection.
- Click "Finish" to save the connection.
-
Manage your database:
Once connected, you can browse your database schema, view and edit data, execute SQL queries, and perform other database administration tasks through Dbeaver’s GUI.
Advantages:
- Feature-rich GUI: Provides a comprehensive and user-friendly interface.
- Multi-database support: Can connect to various database systems (MySQL, PostgreSQL, Oracle, etc.).
- Advanced features: Includes features like data import/export, schema comparison, and SQL editor with syntax highlighting.
- Desktop application: Offers better performance and responsiveness compared to web-based tools.
Disadvantages:
- Installation required: Needs to be installed on your local machine.
- Resource consumption: A desktop application typically consumes more resources than a web-based interface.
- Configuration overhead: Requires initial configuration to connect to your database.
In conclusion, while set up phpMyAdmin on AlmaLinux 9 is a popular choice, using the command-line client and Dbeaver are viable alternatives, each offering unique advantages and disadvantages depending on your specific needs and technical expertise. These alternatives offer greater flexibility and more advanced features.