I created a mysql database with name 123, when i want to drop it,it is not dropping and throwing error. I used query. DROP DATABASE 123; and also tried DROP DATABASE '123'; . The other databases with name like ABC123 are dropping. Any solution would be greatful.
Asked
Active
Viewed 736 times
2 Answers
4
You should never choose such names for DB or tables, however you can drop the database as
DROP DATABASE `123`
Need to use backticks for the db name

Abhik Chakraborty
- 44,654
- 6
- 52
- 63
-
working. thanks for backticks. I was doing with single quotes.. thats why i got error. when used with backticks database has dropped. – Anil kumar Kun Oct 15 '15 at 09:13
3
Try to use this:
DROP DATABASE `123`
You need to put the name inside the backticks.

Rahul Tripathi
- 168,305
- 31
- 280
- 331
-
working. thanks for backticks. I was doing with single quotes.. thats why i got error. when used with backticks database has dropped. – Anil kumar Kun Oct 15 '15 at 09:13
-
@AnilkumarKun:- You are welcome. On a side note: Never use such database names in future. It would be confusing as well as it will create troubles for you. Happy coding. – Rahul Tripathi Oct 15 '15 at 09:16