MariaDB is an open source software for managing databases. MariaDB comes as the default package for CentOS 7 and is located in the official software repository of this operating system. Installing this package on CentOS 7 can be done from the console when you connect to the server via SSH connection.
MariaDB is a MySQL fork. MySQL was available in CentOS 6, but it was replaced in version 7. The development of the MariaDB package is performed by the same developers who have developed MySQL. It uses even the same command controls as MySQL, and in this manual, you can see how to install MariaDB:
Installing MariaDB on CentOS 7 operating system
The installation is simple and runs from a console that is connected to the server via SSH connection (read: SSH Connectivity Guide). After you connect to the server, type:
——
yum install mariadb-server
——
Here’s what it looks like in the console, when prompted, you’ll need to confirm the installation by pressing the Y key on the keyboard:
And the installation is complete, while in the console you can follow the complete process. Now you need to run the mariadb daemon, so type the following:
——
systemctl start mariadb
——
Make sure the daemon is really running:
——
systemctl status mariadb
——
If “active (running)” is printed, this means that the daemon is running:
In order for MariaDB to run together with the boot-up of the system (for example, when you restart the server and needs to be booted automatically when the system is restarted), type the following:
——
systemctl enable mariadb
——
You will receive the following printout:
——
[root@server-oblak ~]# systemctl enable mariadb Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
——
Secure your MariaDB
The default options are not very secure. MariaDB carries with it certain safety procedures and should be used to achieve better security. Type the following in the console that is connected with the server:
——
mysql_secure_installation
——
You will first be asked for a password:
——
Enter current password for root (enter for none):
——
Since you do not have a password yet, press Enter. You will immediately see the following:
——
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]
——
Confirm with Y to enter a new password, as requested. Create a complex password, use upper and lower case letters, numbers and special symbols.
You will get a few more questions to answer with Y/N. If you press Enter, the default setting is selected. Here are the questions:
——
Remove anonymous users? [Y/n] y ... Success! Normally, root should 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 should 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!
——
Finally, be sure to go with Y because it needs to refresh the privileges:
——
Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n]
——
If everything is ok, you get this at the end:
——
Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
——
Testing the MariaDB installation
If MariaDB is properly installed, then it will also display version information if we log in as root user and type:
——
mysqladmin -u root -p version
——
If all information is successfully displayed, then everything is fine:
This completes the installation of the MariaDB package on the CentOS 7 server.
MariaDB, MySQL, CentOS 7
Note that this kind of installation on a clean operating system requires a little more knowledge and experience with server management, package updates, and server monitoring. If this way of managing your server seems to be complicated, we recommend that you hire a system administrator to do this for you, or plan a WHM/cPanel control panel to manage the server.
0 Comments