Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MariaDB cannot start after update: [Warning] Can't create test file /home/mysql/beta.lower-test

I've just updated MariaDB using apt-get dist-upgrade. Now it won't start using service mysql start anymore.

I can however, run it as root or do: sudo -u mysql mysqld_safe then MariaDB starts up fine. The folder /home/mysql is owned by the mysql user and group.

I've found the error to be thrown in this function: https://github.com/MariaDB/server/blob/7ff44b1a832b005264994cbdfc52f93f69b92cdc/sql/mysqld.cc#L9865

I can't figure out what to do next. Any pointers?

like image 790
Bento Avatar asked Jul 22 '16 14:07

Bento


People also ask

Why is Mariadb not starting?

If MariaDB takes longer than 90 seconds to start, then the default systemd unit file will cause it to fail with an error. This happens because the default value for the TimeoutStartSec option is 90 seconds. See Systemd: Configuring the Systemd Service Timeout for information on how to work around this.

Can't create test file mysql lower test?

To sum it up, the can't create test file is not an actual error since it's marked with a [WARNING] sign in the console. But the warning usually means you may have a problem with MySQL datadir folder configuration. You need to check the actual error message that's marked with [ERROR] in the console to fix the issue.


2 Answers

To run MariaDB SQL from /home, in the file /usr/lib/systemd/system/mariadb.service or /lib/systemd/system/mariadb.service, just change :

ProtectHome=true

to :

ProtectHome=false
like image 199
Thomas Avatar answered Oct 24 '22 00:10

Thomas


The answer by Thomas is correct, but get's reset by updates every few months. So here is a permanent solution:

Use systemctl edit mariadb to create a file overwritting the default settings of the mariadb service. (In debian it's located in /etc/systemd/system/mariadb.service.d/override.conf)

Set the same setting Thomas changed in the file:

[Service]
ProtectHome=false

Use systemctl daemon-reload to reload the systemctl config.

like image 12
zuim Avatar answered Oct 24 '22 00:10

zuim