How To Install MariaDB on CentOS 8

Here are the steps to install MariaDB on CentOS 8:

  1. Update the package manager: Run the following command to update the package manager and ensure that it has the latest package information:
sudo dnf update
  1. Add the MariaDB repository: To install MariaDB on CentOS 8, you will need to add the MariaDB repository to your system. Run the following command to add the repository:
sudo dnf -y install https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
  1. Install MariaDB: Once the repository is added, you can install MariaDB using the following command:
sudo dnf install mariadb-server
  1. Start and Enable MariaDB: After installing MariaDB, you will need to start the service and set it to start automatically at boot time. Run the following commands to start the service and enable it:
sudo systemctl start mariadb
sudo systemctl enable mariadb
  1. Secure MariaDB: To secure your MariaDB installation, you can run the following command:
sudo mysql_secure_installation

This command will prompt you to set a root password, remove anonymous users, and disallow remote root login.

  1. Verify Installation: You can verify that MariaDB is installed and running by connecting to the MariaDB server and displaying the version information:
mysql -V

You should see the version of MariaDB that you installed.

You can also use the command systemctl status mariadb to check the status of the service.

Note: If you’re using firewall make sure to allow the port 3306 to allow MariaDB connection.

Leave a Comment