Search code examples
mysqlspecial-charactersdatabase-schema

MySQL database name with illegal characters


I have recently imported a database from a old host. Sadly it contained some databases with names in the following format:

#mysql50#databasename.bak

I want to remove these as they are no longer needed but calling a drop database gives me the following error:

DROP DATABASE `#mysql50#databasename.bak`
Incorrect database name

I have looked in the information_schema and the name is the same including the #s. One interesting thing I have noticed is the directories under /var/lib/mysql do not contain the #s and are in the format databasename.bak.


Solution

  • You can delete the database on the file level.

    See: Where does MySQL store database files on Windows and what is the name of the files