How to Install MariaDB 11.0 With phpMyAdmin on Rocky / AmaLinux
How to Install MariaDB 11.0 With phpMyAdmin on Rocky / AmaLinux

How to Install MariaDB 11.0 With phpMyAdmin on Rocky / AmaLinux

MariaDB is an open-source relational database management system that is a drop-in replacement for MySQL. It is developed by the original creators of MySQL and is widely used in web applications. phpMyAdmin is a free and open-source web-based application that provides a graphical user interface for managing MySQL and MariaDB databases. In this tutorial, we will install MariaDB 11.0 and phpMyAdmin on Rocky / AmaLinux.

Prerequisites

Before starting the installation process, make sure that you have the following:

  • A Rocky / AmaLinux server with sudo privileges.
  • Access to the internet to download and install the required packages.

Step 1: Update the System

The first step is to update the system packages to their latest versions. Open the terminal and execute the following command:

sudo yum update

This command will update all the installed packages to their latest versions.

Step 2: Install MariaDB 11.0

To install MariaDB 11.0, execute the following command in the terminal:

sudo yum install -y mariadb-server

This command will install the MariaDB server on your system. Once the installation is complete, start the MariaDB service and enable it to start at boot time using the following commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Next, run the following command to secure your MariaDB server:

sudo mysql_secure_installation

This command will prompt you to set a root password, remove anonymous users, disallow remote root login, and remove test databases. Follow the prompts and answer the questions to secure your MariaDB server.

Step 3: Install phpMyAdmin

To install phpMyAdmin, execute the following command in the terminal:

sudo yum install -y epel-release
sudo yum install -y phpMyAdmin

This command will install phpMyAdmin and its dependencies on your system.

Step 4: Configure phpMyAdmin

After installing phpMyAdmin, you need to configure it to work with MariaDB. Open the phpMyAdmin configuration file using the following command:

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

In this file, find the following line:

<IfModule mod_authz_core.c>

Add the following lines after it:

# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>

Save and close the file.

Step 5: Restart the Services

After making the necessary changes to the configuration files, restart the services using the following commands:

sudo systemctl restart httpd
sudo systemctl restart mariadb

Step 6: Access phpMyAdmin

Open your web browser and navigate to the following URL:

<http://your-server-ip/phpMyAdmin>

Replace ‘your-server-ip’ with the IP address of your server. You will be prompted to enter your MariaDB username and password. Enter the credentials and click on the ‘Go’ button to access the phpMyAdmin dashboard.

Issues and Fixes

If you encounter any issues during the installation process, try the following fixes:

  • If you get the error ‘No package epel-release available’, run the following command and try again:
sudo yum install -y <https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm>
  • If you get the error ‘Access denied for user ‘root‘@’localhost’ (using password: YES)’, try resetting the MariaDB root password using the following commands:
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables &
mysql -u root
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
FLUSH PRIVILEGES;
exit;
sudo systemctl start mariadb
  • If you get the error ‘Cannot connect: invalid settings’, open the phpMyAdmin configuration file using the following command and replace the existing lines with the following:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Conclusion

In this tutorial, we have shown you how to install MariaDB 11.0 with phpMyAdmin on Rocky / AmaLinux. We have also shown you how to configure phpMyAdmin and access it from a web browser. If you encounter any issues during the installation process, try the available fixes.