KrnlPanic's Linux Notes and Tips

Working with linux since kernel version 2.0.30

MariaDB replaced MySQL in RHEL and Fedora – now what?

I just installed a Fedora virtual machine on my laptop to do some local database testing. I’ve been reluctant up to now to make the change from RHEL6 to RHEL7 due to the huge difference (3.0 kernel, SysV init replaced by systemd, yum replaced by dnf, etc), but this Fedora 23 install kinda forced the issue, and I suppose it’s good to get on into it anyway.

It seems that there was also a change to use MariaDB instead of MySQL, which makes the installation process a little bit different there as well. MariaDB is a MySQL fork, so the mechanics are still the same, it’s just packaged differently with some different features.

Here are the steps to set up a MariaDB server on your machine:

1) Install MariaDB and MariaDB Server:
[root@localhost]# dnf install -y mariadb mariadb-server

2) Enable mariadb to run at startup and start the server:
[root@localhost]# systemctl enable mariadb
[root@localhost]# systemctl start mariadb

3) Run the database setup script to set a root password and some other necessary tasks:
[root@localhost]# mysql_secure_installation


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 should just press enter here.

Enter current password for root (enter for none): type enter
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorization.

Set root password? [Y/n] Y
New password: your-password
Re-enter new password: your-password
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 for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

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!

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, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

That’s basically all there is to it! Now just login and enjoy!

[root@localhost]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g
Your MariaDB connection id is 12
Server version 10.0.23-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>