Starting Daily apt upgrade and clean activities stopping mysql service
Solution 1:
I'm not sure it's possible to stop mysql from being killed by the update process. I've had the same problem and I disabled unattended updates entirely so that I can do them on my own schedule (after also testing them in a qa environment). To disable the automatic daily updates entirely:
sudo apt-get remove unattended-upgrades
sudo systemctl stop apt-daily.timer
sudo systemctl disable apt-daily.timer
sudo systemctl disable apt-daily.service
sudo systemctl daemon-reload
Solution 2:
I've had this issue occur as well. Mysql stopped for no apparent reason. Upon further investigation of the syslog I found this
systemd[1]: Starting Daily apt upgrade and clean activities...
systemd[1]: Stopping MySQL Community Server...
systemd[1]: Stopped MySQL Community Server.
The way to fix this problem was to use apt-mark hold
to stop updates to all packages that have mysql
in their name, this way mysql will never shut down for updates. This will, however, stop automatic updates.
Another way to solve this was to make sure the systemd unit for mysql is enabled
. In that case it would reboot right back up after the update, so no need to blacklist the package with apt-mark hold
.