MySQL: Invalid (old?) table or database name
Description
After updating MySQL to a newer version, you might encounter the following error message when trying to start the MySQL service again:
[ERROR] [MY-010520] [Server] Invalid (old?) table or database name 'lost+found'
[ERROR] [MY-010022] [Server] Failed to Populate DD tables.
[ERROR] [MY-010119] [Server] Aborting
This might especially be the case if your /var/lib/mysql
data directory is located on a separate partition or disk which causes the lost+found
directory to be created by the filesystem.
MySQL then tries to treat the directory as a database and fails to populate the data dictionary tables.
Solution
In order to solve the issue and start the MySQL service again you have two possibilities. First is to change the permissions of the folder so no one can access it anymore. That can be done with the following command:
chmod 0 /var/lib/mysql/lost+found
The second possibility is to instruct MySQL to ignore the lost+found
directory. This can be done by adding the following line to your MySQL configuration file (usually located at /etc/my.cnf
or /etc/mysql/my.cnf
) under the mysqld
section:
ignore-db-dir=lost+found
If your error message mentions a different directory than lost+found
, you should replace lost+found
with the directory name mentioned in the error message.