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.

When I created a mysql database, I named it using a hyphen, like aaron-kyle.

When I check the database, I see:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| respect-joomla     |
+--------------------+

But I can't delete the database.

The specific command I used was:

mysql> drop database respect-joomla;

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 '-joomla' at line 1

I also tried:

mysql> DROP DATABASE 'respect-joomla';

I get the same 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 ''respect-joomla'' at line 1

Are there special ways to write - in mysql (like space in the command line is \ \ ) ?

share|improve this question
    
Perhaps if you showed us the command you tried to use? You have a syntax error but right now we can only guess why. –  John Gardeniers Sep 4 '12 at 11:25
    
Sorry for the delayed reply, John! I have updated the question. Thanks for looking at this! –  aaron.kyle Sep 18 '12 at 16:00

1 Answer 1

up vote 1 down vote accepted

Try something like:

DROP DATABASE `aaron-kyle`;
share|improve this answer
    
Thanks, Michael, for this suggestion. I had tried with the ', but it also didn't work. Any other ideas? –  aaron.kyle Sep 18 '12 at 16:01
    
Read more carefully what I posted in the answer. You should use ` not '. –  Michael Hampton Sep 18 '12 at 16:06
    
Thanks Michael! Too new to appreciate that there was a difference. Using the back tick worked! –  aaron.kyle Sep 18 '12 at 16:07

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.