How to fix "[InnoDB] Could not find any file associated with the tablespace ID" when files exist (ubuntu)

If you are running a recently upgraded Ubuntu Linux OS and you suddenly run into the issue of:

[InnoDB] Could not find any file associated with the tablespace ID

and you have physically checked that the files are present where they are supposed to be (and if that is not in the standard /var/lib/mysql location) then your problem could be AppArmor.

 

Ubuntu AppArmor is a system-level mechanism that controls what resources can be accessed by a program. When enabled (by default on some upgrades and Ubuntu Images) it can block your MariaDB/MySQL/Percona install from accessing the files it needs to operate.

AppArmor is a Linux Security Module implementation of name-based mandatory access controls. AppArmor confines individual programs to a set of listed files and posix 1003.1e draft capabilities.

AppArmor is installed and loaded by default. It uses profiles of an application to determine what files and permissions the application requires. Some packages will install their own profiles, and additional profiles can be found in the apparmor-profiles package.

AppArmor can be disabled for MySQL/MariaDB/Percona by executing the following commands:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

Afterwards, you can run the command sudo aa-status to see if the mysql profile is loaded.

Should you want to re-enable AppArmor you can use:

sudo rm /etc/apparmor.d/disable/usr.sbin.mysqld
sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
sudo aa-status
  • 0 Users Found This Useful
Was this answer helpful?

Powered by WHMCompleteSolution