Updating Ubuntu (from one version to another) and restarting MySQL…..oops it doesn’t work…because for me, the data directory is located outside the standard path, and so apparmor is not happy.

To keep it simple and avoid further issues: Backup your MySQL configuration file:

$ sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.backup

Modify the Apparmor configuration by adding a file:

$ sudo nano /etc/apparmor.d/local/usr.sbin.mysqld

This adds a machine-specific file for local settings containing additional parameters, without changing the base configuration. File content:

# Site-specific additions and overrides for usr.sbin.mysqld.
# For more details, please see /etc/apparmor.d/local/README.

/dbs/mysql/ r,
/dbs/mysql/** rwk

And then, run the updates.