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:
Is
/lib/systemd/system/mysql.service
the file I should be editing?Why are there so many
mysql.service
files? This seems to cause confusion.What is
multi-user.target.wants
? Should I change themysql.service
file in there also?Some simple googling reveals that
lxcfs
is short for Linux Containers, should I change any of themysql.service
files in there ?