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.


This last option worked for me (from quazgar). I have Ubuntu 18.10 installed with MariaDB 10.3.13:

$ echo "/usr/sbin/mysqld { }" > /etc/apparmor.d/usr.sbin.mysqld
$ apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
$ systemctl restart mariadb

I had to use "sudo su" for it to work though.