Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to DROP a database with character '?' in its name?

Just trying out ubuntu server on my pc and have been testing some commands including mysql. I'm not sure why phpMyAdmin permitted me to create a database like this 'testing?db'. I'm trying to drop this database via SSH but I get this error:

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| phpmyadmin         |
| testing?db         |
| testing_db         |
| wp                 |
+--------------------+
6 rows in set (0.00 sec)

mysql> DROP DATABASE testing?db;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?db' at line 1
mysql>

I tried creating a database with a '?' in it and it also gives me syntax error. via ssh. so how do I remove this database?

like image 863
hugseirvak Avatar asked Mar 27 '11 03:03

hugseirvak


People also ask

Which command can be used to destroy the existing database?

The DROP DATABASE statement is used to drop an existing SQL database.

Which command is used to drop a database?

DROP is used to delete a whole database or just a table. The DROP statement destroys the objects like an existing database, table, index, or view.


1 Answers

Try:

DROP DATABASE `testing?db`;
like image 115
mvds Avatar answered Sep 29 '22 05:09

mvds