How To Install MariaDB on CentOS 7

   

Introduction: MariaDB is a popular open-source relational database management system (RDBMS) that is widely used for building and managing databases. In this guide, we will walk you through the steps to install MariaDB on CentOS 7.

Prerequisites:

- A CentOS 7 server with root or sudo access.

- Access to a terminal window or SSH access to connect to the server.

Step 1: Update System Packages

Before installing any new software, it's a good practice to update the system packages to their latest versions. Run the following commands to update the package index and upgrade installed packages:

sudo yum update -y 

Step 2: Install MariaDB

You can install MariaDB from the CentOS repository using the yum package manager. Run the following command to install MariaDB :

sudo yum install mariadb-server -y

Step 3: Start and Enable MariaDB

Once MariaDB is installed, start the MariaDB service and enable it to start automatically at boot time by running the following commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 4: Secure MariaDB Installation

MariaDB provides a script called mysql_secure_installation that helps secure the MariaDB installation by setting a root password, removing test databases, disabling remote root login, and so on. Run the script by executing the following command :

sudo mysql_secure_installation

Follow the prompts to set up the security options according to your preferences. You will be prompted to set the root password, remove anonymous users, disallow root login remotely, remove test databases, and reload privilege tables.

Step 5: Access MariaDB

Once MariaDB is installed and secured, you can access the MariaDB shell by typing the following command :

sudo mysql -u root -p

Enter the root password you set during the mysql_secure_installation process. You will then be logged into the MariaDB shell, where you can start interacting with the database management system.

Step 6: Additional Configuration (Optional)

Depending on your requirements, you may need to perform additional configuration for MariaDB, such as creating new databases, managing users, configuring database replication, and more. Refer to the MariaDB documentation for detailed instructions on advanced configuration options.

Conclusion :

Congratulations! You have successfully installed MariaDB on CentOS 7. You can now start using MariaDB to create, manage, and administer databases for your applications. If you encounter any issues during the installation process, refer to the official MariaDB documentation or seek assistance from the community.