Auto-start MariaDB using systemd after it has crashed

Mahdi asked:

I am trying to set up MariaDB in a way that it automatically recovers — basically restarts, from a crash.

Based on this article — scroll down to Auto-starting Services with systemd, I opened /etc/systemd/system/ file but there were nothing like this as the article explains:


So I added the [Service] section and the Restart=always underneath, restarted the service and killed the process to see if it will start automatically, but it didn’t.

I was wondering if I’m editing the wrong file or if there are other ways of achieving the same thing. Server is a remote machine running CentOS 7.

My answer:

After making changes to systemd units, you need to run systemctl daemon-reload for those changes to have effect.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.