How to install MariaDB on CentOS 8

How to install MariaDB on CentOS 8

MariaDB is a free and open-source relational database management system (RDBMS). It’s designed to be a drop-in replacement for MySQL, another popular RDBMS. Here’s a breakdown of what that means:

  • Relational Database: MariaDB stores data in a structured format with tables and relationships between them. This makes it efficient for organizing and querying large amounts of data.
  • Open-Source: The source code for MariaDB is freely available, allowing anyone to inspect, modify, and contribute to its development. This fosters a collaborative community and ensures transparency.
  • MySQL Replacement: MariaDB was created by some of the original developers of MySQL. It’s highly compatible with MySQL, meaning applications designed for MySQL can often run seamlessly on MariaDB.

Here are some key features of MariaDB:

  • Performance: MariaDB is known for its good performance and scalability, making it suitable for various applications.
  • Stability: It has a reputation for being stable and reliable.
  • Security: MariaDB offers various security features to protect your data, like user authentication and encryption.

Overall, MariaDB is a powerful and versatile option for anyone needing a free and open-source relational database solution.

Here’s how to install MariaDB on CentOS 8:

1. Update your system:

Before you begin, ensure your system is up-to-date using the following command:

sudo dnf update

2. Install MariaDB:

Use the following command to install MariaDB and its dependencies:

sudo dnf install @mariadb

3. Start and enable MariaDB service:

Enable and start the MariaDB service with these commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

4. Secure MariaDB:

MariaDB security:

The MariaDB server package performs several security-related operations and sets the master password with a script called mysql_secure_installation. Verify the script by typing the following command:

sudo mysql_secure_installation

You will be prompted to set a password for the MariaDB root user. After doing this, the script will also ask you to remove the anonymous user, restrict root access to the local machine, and remove the test database. You must answer “yes” “Y” to all questions. You have installed and secured MariaDB on your CentOS server and are ready to use it.

5. Verify the installation:

To confirm MariaDB is installed and running correctly, use the following command:

sudo systemctl status mariadb

The output should show the service is “active (running)”.

6. Connect to MariaDB:

Finally, you can connect to the MariaDB shell as the root user using:

sudo mysql -u root -p

When prompted for the password, enter the one you set in step 4.

Additional Tips:

  • If you don’t want to use the root user, create a new user with appropriate privileges for daily usage.
  • Edit the /etc/my.cnf file for further MariaDB configuration.

Conclusion :

In this tutorial, we showed you how to install and secure MariaDB on CentOS 8 and how to connect to the MariaDB server from the command line. Now that your MariaDB server is up and running, you can connect to the MariaDB shell and start creating new databases and users.
support hosting100