One member of the dev team managed to create one databases with a "-" in the name with a remote graphical interface (and I think the second one is a legacy DB).
I am trying to remove both of them with the
DROP DATABASE "dbname-a";
command inside the mysql
command line interface, however I am getting back the error:
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 '"dbname-a"' at line 1
I tried using the db name with and without "", and also inside ' '. all variations presented the same syntax error.
What to do?
I believe the correct way to do this would be with backtick quoting. For example:
DROP DATABASE `dbname-a`
This true for MySQL reserved keyword as well. Lots more info on this Stack Overflow post - When to use single quotes, double quotes, and backticks in MySQL.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments