How To Install MariaDB on AlmaLinux 9

To install MariaDB on AlmaLinux 9, follow the steps below:

Step 1 : First, update your system packages to ensure everything is up-to-date:

Step 2 : Next, install MariaDB from the official AlmaLinux repository:

Step 3 : Now, start the MariaDB service and enable it to start on boot:

Step 4 : Run the mysql_secure_installation script to improve the security of your MariaDB installation. Follow the prompts as outlined below:

- Enter the root password: If you haven't set a root password yet, just press Enter to leave it blank.

- Switch to unix_socket authentication: Choose y to use unix_socket for authentication.

- Change the root password: Choose y to set a root password.

- Remove anonymous users: Choose y to remove anonymous user accounts.

- Disallow root login remotely: Choose y to prevent root from logging in remotely.

- Remove the test database and access to it: Choose y to remove the test database.

- Reload privilege tables now: Choose y to apply the changes.

Step 5 : Verify that MariaDB is running properly by checking its status:

Step 6 : To access the MariaDB shell, use the following command:

Step 7 : Once inside MariaDB, you can create an admin user and grant privileges. Run the following commands:

Congratulations! You have successfully installed and secured MariaDB on AlmaLinux 9.