MariaDB is an open source relational database management system, which is backward compatible and can replace MySQL. It was jointly developed by some of the original developers of MySQL and many community members.
In this article, we will explain how to install and protect MariaDB 10.3 on CentOS 8.
At the time of writing this article, the MariaDB version available in the CentOS 8 source repository is 10.3.
Run the following command as a root user or another user with sudo privileges to install MariaDB 10.3 on CentOS 8.
sudo dnf install @mariadb
The mariadb
module can install MariaDB and all dependent packages.
Once the installation is complete, start the MariaDB service, and start the boot, enter:
sudo systemctl enable --now mariadb
To verify that the MariaDB server is running, enter:
sudo systemctl status mariadb
The output shows that the service is active and enabled:
● mariadb.service - MariaDB 10.3 database server
Loaded:loaded(/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active:active(running) since Sun 2019-12-0821:05:26 UTC; 15s ago
...
MariaDB server has a script called mysql_secure_installation
, which can perform the following security-related operations and set the root user password:
Run the following script:
sudo mysql_secure_installation
You will be prompted to set the password of the MariaDB root user. Once you are done, this script will ask you to remove anonymous users, restrict root user access to the local machine, and remove the test database. For all questions, you should answer "Y" (yes).
And that's all. You have installed and protected MariaDB on your CentOS server, and you are ready to use it.
To connect to the MariaDB server through the terminal, enter:
mysql -u root -p
When prompted, enter the root user password, and the MariaDB shell window will display as follows:
Welcome to the MariaDB monitor. Commands end with; or \g.
Your MariaDB connection id is 18
Server version:10.3.11-MariaDB MariaDB Server
Copyright(c)2000,2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
In this guide, we showed you how to install and secure MariaDB on CentOS 8, and how to connect to MariaDB server from the terminal command line.
Now that your MariaDB server is up and running, you can connect to the MariaDB shell and start creating databases and users.
CentOS 8 also provides MySQL 8.0. If you want to install MySQL instead of MariaDB, you can browse: How to install MySQL on CentOS 8. Please note that you are not installing MariaDB and MySQL on the same server at the same time.
Recommended Posts