I set up my first Ubuntu Server with Ubuntu 16.04, nginx, php7.0, MariaDB, nextcloud and external DynDNS using this tutorial here: Install Nextcloud 9 on Ubuntu 16.04
FYI:
In my case neither the solution of Vincent or Lw Bi worked exactly, I needed some further actions.
Disabling the profile through placing a link in /etc/apparmor.d/disable/
simply didn't work, I don't know why.
On the other hand, setting MySQL to complain mode didn't work either immediately.
:~$ sudo aa-complain /usr/sbin/mysqld
Setting /usr/sbin/mysqld
to complain mode.
ERROR: /etc/apparmor.d/usr.sbin.mysqld contains no profile
I needed to add the lines:
/usr/sbin/mysqld {
}
to /etc/apparmor.d/usr.sbin.mysqld
, and then I could set it to complain mode successfully.
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.
Run the following commands:
sudo dpkg --configure -a
sudo service mysql start
In case you are bitten by this bug, the solution is given as a suggestion in the bug report:
echo "/usr/sbin/mysqld { }" > /etc/apparmor.d/usr.sbin.mysqld
apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
systemctl restart mariadb
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.