Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How can i delete database with # in name? Like that: #mysql50#mysql.backup

I don't know who is possible to created it, but it happened. When I try DROP DATABASE name, I have error:

ERROR 1102 (42000): Incorrect database name

Thank you for helping.

share|improve this question
    
What is the command you tried to run? –  Bart De Vos Oct 30 '12 at 10:38
1  
I wonder if you could just delete the myisam files. Risky, but if all else fails. –  Tom O'Connor Oct 30 '12 at 10:41
    
I tried "DROP DATABASE #mysql50#mysql.backup" –  Rafał Kamiński Oct 30 '12 at 10:46
1  
Is it correct that the database name is "#mysql50#mysql" and that "backup" is a table? Even when using proper escaping, a dot (.) should not be allowed in names. –  Cheatah Oct 30 '12 at 11:08

5 Answers 5

You might have hidden folder in data directory. Please do a ls -larth and the remove mysql.backup directory.

By default any folders inside the mysql data directories will be read as database and will be shown in "show databases".

share|improve this answer

You should always escape database names using backtick quotes, at least in case of doubt.

DROP DATABASE `#mysql50#mysql.backup`
share|improve this answer
    
Is not possible :( mysql> DROP DATABASE #mysql50#mysql.backup; ERROR 1102 (42000): Incorrect database name '#mysql50#mysql.backup' I used backtick :( –  Rafał Kamiński Oct 30 '12 at 11:09

If the storage engine of the database is MYISAM just stop the database server and remove the directory named after your database in you data directory. (default var/lib/mysql)

share|improve this answer

What you could try is to change the name of the database by changing the name of its data directory and then drop the database or just directly delete the directory if you want and the database is deleted as well.

share|improve this answer
    
Your guess is wrong. Both the hash (#) and dot (.) are normally not allowed in database/table/column names. –  Cheatah Oct 30 '12 at 11:07
    
You are right Cheatah! I will fix that now. –  Adia Oct 30 '12 at 11:21

Could it be that you were in a different SQL mode when this table got created? Database names like this would be possible on different SQL servers. What you can try is to switch MySQL to a different SQL mode as described here and then try to drop the table.

If this doesn't work then I would recommend as well to delete the database files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.