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

匿名 (未验证) 提交于 2019-12-03 02:56:01

问题:

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?

回答1:

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

ProtectHome=true 

to :

ProtectHome=false 


回答2:

@RedGiant yes I solved it. Forgot to post here.

Apparently after the .1 release you cannot run SQL from /home anymore. There's probably a way around this but haven't found it.

I can run MySQL from any location except /home. What I did was unmount /home (I had my SSD RAID mounted to /home) and re-mount my disk as /ssd. Changed my paths in the config and it worked right away.

I did not run SELinux or Apparmor.



回答3:

Same situation after update on Debian 8 (Jessie) and 9 (Stretch). After "apt-get upgrade" the command

  • service mysql start

the server fails to start and logs error:

[Warning] Can't create test file /home/johndoe/UserDatabases/mypcname.lower-test

the solution is to change in file /lib/systemd/system/mariadb.service the value:

ProtectHome=true 

to

ProtectHome=false 

as described above.



回答4:

The workaround for this is mounting the directory in home as /var/lib/mysql:

mount --bind /home/mysql/var/lib/mysql /var/lib/mysql 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!