mariadb/mysql -- more informations at first launch

Greetings in this 2017 year !!

I experienced strange things I already had in the past: when mariadb/mysql hasn’t been used yet on a system, for example, when you decided to create your first database, as it was the case with my student’s computers last friday…

The mysql.service won’t start until you set the correct proprietary user for the folder /usr/lib/mysql.
You have to chown -R mysql:root /usr/lib/mysql to make it work.

If this thread could be useful for those still in 13.2.
I did not yet checked if the settings were correct on my unique 42.1 computer. On my three 13.2 versions, here at home, this folder is set to mysql:root but on all the 13.2 computers in my lab, none of them were correctly set.

We first did mysql_install_db and tried to set the root password using the advices given by the mysql_install_db output… but never succeeded until I asked the students to READ the output of the systemctl status mysql.service command.
There the students saw that there was a permission issue.

MySQL/Mariadb installs with a script you can run that sets up your initial security called


Just run that script, you’ll be prompted for all the settings that should be set on first install.

If you need to set up a large number of instances, or if you want to standardize setups, I describe how you can automatically run and answer the script in a Here Document

Your steps for changing ownership should not be necessary, and may even be inadvisable.
To start, just run the following

systemctl start mysql.service


thanks… I will try your solution next time.