Maria Database Is a free open source Database management system And act as Oracle MySQL database server. It is a community-driven and development branch of Oracle MySQL Server. MariaDB is a multi-user, multi-threaded SQL database server. In this tutorial we will explain How to install and protect MariaDB 10.4 on CentOS 8.
Install MariaDB on CentOS 8
If no critical services are running in the production environment on the server, please update your system before you start installation of MariaDB 10.4 on CentOS 8.
# dnf -y upgrade
Now we need to add MariaDB yum repository Used in our CPU architecture. This guide will cover adding repositories for x86_64 CPU computers.
cat <> /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF
After adding the Yum repository, you can immediately install the MariaDB 10.4 repository to CentOS 8.
We need to temporarily disable rhel-8-for-x86_64-appstream-rpms and AppStream repositories on CentOS 8 respectively to allow yum to download packages from MariaDB mirrors.
# dnf install -y boost-program-options # dnf --disablerepo=AppStream install -y MariaDB-server MariaDB-client
After the installation is complete, start the MariaDB service and make it start automatically at startup by typing:
# systemctl enable --now mariadb
To verify that the MariaDB server is running, type:
# systemctl status mariadb
The output should show that the service is active and enabled:
# systemctl status mariadb ● mariadb.service - MariaDB 10.4.12 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: active (running) since Thu 2020-02-13 19:25:16 UTC; 8s ago Docs: man:mysqld(8) ......................................
Secure MariaDB database server
The MariaDB server package comes with a package called
mysql_secure_installation Perform some security related operations and set the root password. Run the script by typing:
You will be prompted to set a password for the MariaDB root user. When this is done, the script will also ask you to delete anonymous users, restrict root user access to the local computer, and delete the test database. You should answer
“Y” (Yes) All questions. That’s it! You have MariaDB installed and secured on the CentOS server and are ready to use it.
To connect to MariaDB server via terminal as root account type:
# mysql -u root -p
Enter the root password when prompted and you will be provided with the MariaDB shell as shown below:
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 18 Server version: 10.4.12-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 tutorial we showed you how to install and Safe MariaDB Up CentOS 8And how to connect to MariaDB server From the command line. If you have any questions or feedback, feel free to leave a comment.