To install MariaDB on Rocky Linux 9, follow the steps below.
Step 1 : Update the package repository to ensure you have the latest information about available packages.
Step 2 : Install the MariaDB server package using the package manager.
Step 3 : Start the MariaDB service and enable it to start on boot.
Step 4 : Secure MariaDB
- Run the MariaDB security script to enhance the security of your installation.
Follow the on-screen prompts:
- Enter the root password (press Enter if not set).
- Switch to unix_socket authentication: Answer 'y'.
- Change the root password: Answer 'y' and set a strong password.
- Remove anonymous users: Answer 'y'.
- Disallow root login remotely: Answer 'y'.
- Remove the test database and access to it: Answer 'y'.
- Reload privilege tables now: Answer 'y'.
Step 5 :Check the status of the MariaDB service to ensure it is running.
Step 6 : Access the MariaDB server with the MySQL command-line client.
Step 7 : Create Admin and Grant Privileges
Inside the MariaDB shell, create an admin user and grant necessary privileges.
Congratulations! You have successfully installed and secured MariaDB on Rocky Linux 9.