If we are loyal XAMPP users, since October 2015 there have been major changes that have taken place. Where the default database in the XAMPP bundle has changed from MySQL to MariaDB. Actually it’s not only XAMPP that has changed, but there are many client tools that come to use MariaDB as the default database. MariaDB replaced MySQL as the default database system in the CentOS 7 repositories. At this time, we will discuss how to install and secure MariaDB on CentOS 7.
MariaDB was created by one of MySQL’s original developers in 2009 after MySQL was acquired by Oracle during the Sun Microsystems merger. Today MariaDB is maintained and developed by the MariaDB Foundation and community contributors with the intention of it remaining GNU GPL software From the prerqusite, install and securing MariaDB.
The article will be divided up to 3 sections:
As usual, when we install new software, we must first update our Centos system.
[ramans@localhost ~]$ sudo yum update [sudo] password for ramans: Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile epel/x86_64/metalink | 7.6 kB 00:00
The result is as described below :
The next step is to nable the MariaDB repository. We have to create a repository file named MariaDB.repo and add the following content inside it :
[ramans@localhost ~]$ sudo vi /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
After we have done for the prerequisite steps, the we install the MariaDB from repository that has been added, you can easily install it with just one single command,
sudo yum install MariaDB-server MariaDB-client -y.
[ramans@localhost ~]$ sudo yum install MariaDB-server MariaDB-client -y
The next step is verifying the installation process by querying the mariadb daemon status.
[ramans@localhost ~]$ systemctl start mariadb [ramans@localhost ~]$ systemctl enable mariadb [ramans@localhost ~]$ systemctl status mariadb
We will be promted to fill the password for starting up and enabling the Maria DB as shown below. Please enter the correct password for this purpose.
Until now, the MariaDB has been up and ready to be used, we could check it by querying the MariaDB status via
systemctl status mariadb command. The status is
Active: active (running) since Thu 2019-11-14 16:40:09 WIB; 1min 10s ago.
[ramans@localhost ~]$ systemctl status mariadb mariadb.service - MariaDB 10.1.43 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 2019-11-14 16:40:09 WIB; 1min 10s ago
To secure our MariaDB is by setting root password, disabling remote root login, removing the test database as well as anonymous users and finally reload privileges, all this step can be done with a single command
sudo mysql_secure_installation. As shown in the screen shot below.
[ramans@localhost ~]$ sudo mysql_secure_installation [sudo] password for ramans: NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
Maybe the other time we will continue to manage and explore the MariaDB feature in other articles.
Have a nice day !