If within a MySQL instance a schema name such as “#mysql#lost+found” or “#lost+found” is listed when the “show schemas” or “show databases” command is run, it’s not a true schema but will appear when MySQL is installed in a root directory on a Linux server.

At the root level of any mount or partition on the server, the lost+found directory exists as a location where any corrupt files found by the file system are placed. Similarly, suppose any other directory is found or created within the MySQL data directory. In that case, MySQL will list it as a schema even though there are no tables or data associated with it. The lost+found directory itself doesn’t interfere with MySQL’s operations; however, it will throw an occasional error in the error log:

[ERROR] Invalid (old?) table or database name ‘lost+found’

To avoid these errors, installing MySQL in a subdirectory of a mount, typically /var/lib/mysql, is a common practice. If the database installation cannot be moved to a subdirectory for whatever reason, a quick change to MySQL’s configuration file can be made to have MySQL ignore this directory if you’re using MySQL v5.6+. Adding “ignore_db_dir = lost+found” to the config file and restarting the database instance will stop the errors and have lost+found stop appearing as a schema when “show schemas” is run or when “information_schema” is queried covering all schemas. More than one directory can be ignored; however, a separate line in the config file with ignore_db_dir is needed for each one.

Summary: If MySQL is throwing errors in the error log such as “[ERROR] Invalid (old?) table or database name ‘lost+found’,” there are two options to resolve this error. One is to have MySQL ignore the directory with ignore_db_dir = lost+found (or another appropriate directory name) placed in MySQL’s configuration file. The change will require a restart of MySQL to take effect. The other option is to move the data directory out of a root level to a subdirectory where a lost+found directory is not located.

Share This