Comments - What to Do if MariaDB Doesn't Start

7 years, 5 months ago comar

As Leho mentioned it may be also a case, f.e. if you update your Debian 8 installation to Debian 9. I had my datadir symlinked from /var/lib/mysql to my /home/mysql and I was getting errcode 13 Permission denied, even if mysql users had all the chmod's properly set. I had to change ProtectHome to false in /etc/systemd/system/multi-user.target.wants/mariadb.service

 
7 years, 3 months ago Damien Norris

Further to the Debian 9 issue where you get Permission Denied if your data dir is located under /home....

The correct way to override this setting is to make a local copy in /etc/systemd/system:

1: sudo cp /lib/systemd/system/mariadb.service /etc/systemd/system

2. Edit /etc/systemd/system/mariadb.service and change ProtectHome to be false (ProtectHome=false). Save the file

3. sudo systemd daemon-reload # refresh the systemd services so it sees your override file

4. sudo systemctl start mysql # and it should finally start

I spent ages searching for AppArmor and SELinux fixes to this problem, when it's just systemd preventing MySQL from writing to /home.

 
7 years ago Daniel Black

The more correct is to create /etc/systemd/system/mariadb.service.d/homedir.conf

[Service]
ProtectHome=false

This way the rest of the systemd file is preserved and other changes during upgrade still occurs. See MariaDB systemd documentation: https://mariadb.com/kb/en/library/systemd/. Thanks for contributing, this form of failure sure be documented here too.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.