Install and configure MariaDB on RHEL/CentOS
MariaDB is an open-source relational database and a MySQL database branch version developed by the community. MariaDB has replaced MySQL as the default database in RHEL/CentOS 7.
In this tutorial, we will discuss installing and configuring MariaDB on CentOS/RHEL 7 machines.
(MariaDB management commands for beginners)
Install
From RHEL/CentOS 7, MariaDB can be used as the default repository for two operating systems. Therefore, we can simply use yum for installation. To install it, run the following command from the terminal,
$ Yum install mariadb-server
Once installed, we will start its service and enable it,
$ Systemctl start mariadb
$ Systemctl enable mariadb
The database is currently running. You can log on to Mariadb by running
$ Mysql
In the terminal. The default password of the root user is blank by default. You can imagine this is a serious security threat. So now we will make sure that our installation is complete.
Configure MariaDB
We will now run "mysql_secure_installation" on our terminal to protect our MariaDB installation. Make sure that you carefully read every step of the program to ensure installation,
$ Mysql_secure_installation
/Usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: running all parts of this script is recommended for all MariaDB
Servers in production use! Please read each step carefully!
In order to log into MariaDB to secure it, we'll need the current
Password for the root user. If you 've just installed MariaDB, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.
Enter current password for root (enter for none ):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.
Set root password? [Y/n] Y
New password: ROOTPASSWORD
Re-enter new password: ROOTPASSWORD
Password updated successfully!
Reloading privilege tables ..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
To log into MariaDB without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.
Remove test database and access to it? [Y/n] Y
-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you 've completed all of the above steps, yourMariaDB
Installation shoshould now be secure.
Thanks for using MariaDB!
In this way, our database is secure and ready for use. We can now log on to our installed MariaDB.
$ Mysql-u root-p
You can create new databases, tables, or users.
This is our tutorial on installing and configuring MariaDB. If you have any questions or questions, refer to the comment box below.
For more MariaDB tutorials, see the following:
Install Nginx, MariaDB, and HHVM on Ubuntu 16.04 LTS to run WordPress
Install MariaDB in Ubuntu 16.04 Dockerfile
Linux Tutorial: How to check the MariaDB server version
How to install MariaDB in Ubuntu 16.04
CentOS 7.3 binary installation of MariaDB10.2.8 steps
CentOS 7 build and install MariaDB-10.1.22
How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu
Install MariaDB on the Ubuntu 14.04 (Trusty) Server
MariaDB details: click here
MariaDB's: click here