show databases; +-----------------...">

Unable to delete database due to illegal nature

How can I delete a database containing a "-" character?

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | vms01 | | vms-0.1.0 | +--------------------+ 4 rows in set (0.00 sec) mysql> drop database vms-0.1.0; 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 n ear '-0.1.0' at line 1 mysql> 
+8
mysql sql-drop
source share
1 answer

You can specify identifiers (for example, table and column names) with reverse windows:

 drop database `vms-0.1.0` 

For more information, see the documentation: Schema Object Names .

The identifier quote character is the flip side ("` "):

+17
source share

All Articles