dmanners
dmanners

Reputation: 2072

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.

Upvotes: 3

Views: 2092

Answers (3)

George Chondrompilas
George Chondrompilas

Reputation: 3237

Have you tried using a database management software as navicat or phpmyadmin in order to delete it?

Also do you have root access to the computer which got the db? You should be able to go into the mysql data dir and delete the database at a file level. My data dir is /var/lib/mysql. Inside that directory, you will see all your databases (as directories), just remove the directory named after the database.

Upvotes: 1

CloudyMarble
CloudyMarble

Reputation: 37566

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

Upvotes: 1

juergen d
juergen d

Reputation: 204746

Try

DROP DATABASE `\#mysql50\#databasename.bak`

or

DROP DATABASE `##mysql50##databasename.bak`

Upvotes: 0

Related Questions