I need to edit the
mysql.service file to make MySQL automatically restart when it crashes. I'm working with a pretty much stock Ubuntu 18.04 server install and followed these instructions https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04 for a pretty much stock MySQL install.
My concern is I'm not sure where to edit
mysql.service. If I do this:
sudo updatedb locate mysql.service
I get this:
/etc/systemd/system/multi-user.target.wants/mysql.service /lib/systemd/system/mysql.service /var/lib/lxcfs/cgroup/blkio/system.slice/mysql.service /var/lib/lxcfs/cgroup/cpu,cpuacct/system.slice/mysql.service /var/lib/lxcfs/cgroup/devices/system.slice/mysql.service /var/lib/lxcfs/cgroup/memory/system.slice/mysql.service /var/lib/lxcfs/cgroup/name=systemd/system.slice/mysql.service /var/lib/lxcfs/cgroup/pids/system.slice/mysql.service /var/lib/systemd/deb-systemd-helper-enabled/mysql.service.dsh-also /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/mysql.service
This is strange because I'm used to systemd
.service files being located in
/etc/systemd/system. Since the path is similar, I would be inclined to suppose that
/lib/systemd/system/mysql.service is probably the file I should edit. However if anybody could provide some additional information on the following that would be great:
/lib/systemd/system/mysql.servicethe file I should be editing?
Why are there so many
mysql.servicefiles? This seems to cause confusion.
multi-user.target.wants? Should I change the
mysql.servicefile in there also?
Some simple googling reveals that
lxcfsis short for Linux Containers, should I change any of the
mysql.servicefiles in there ?