mysql service fails to start/hangs up – timeout (Ubuntu, MariaDB)

In case you are bitten by this bug, the solution is given as a suggestion in the bug report (all of these have to be done as root, so either with sudo -i as a zeroth command or with sudo prefixed):

  1. echo "/usr/sbin/mysqld { }" > /etc/apparmor.d/usr.sbin.mysqld (the second part with sudo is ... | sudo tee /etc/apparmor.d/usr.sbin.mysqld, thank you @dvlcube)
  2. apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
  3. systemctl restart mariadb

Background

If you previously had MySQL installed, it activated an AppArmor profile which is incompatible with MariaDB. apt-get remove --purge only removes the profile, but does not deactivate/unload it. Only manually unloading it lets MariaDB work unhindered by AppArmor.

Leave a Comment