I have installed MySQL on my Arch Linux server. I moved the data directory to a place under /home, where my RAID volume is mounted. I noticed that mysqld will not start in this configuration by default since the systemd unit contains the setting ProtectHome=true.

I want to override just this setting. I don't want to re-specify the ExecStart or similar commands, in case they change when the package is upgraded.

I tried making a simple file at /etc/systemd/system called mysqld.service and added only these lines:

[Service]
ProtectHome=false

This doesn't work as it looks like the service in /etc replaces, not overrides, the system service.

Is there a way to override settings in systemd unit files this way without directly modifying the files in /usr/lib/systemd/system? (which is what I have done for now as a temporary fix, although that will end up reverted if the package is updated)

up vote 3 down vote accepted

You may override a systemd unit file using

systemctl edit mysqld.service

Any statements made in the override file will take priority.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.