Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyphen in database name

Status
Not open for further replies.

pen81

Programmer
Oct 27, 2004
62
GB
I get a syntax error when attempting to drop one of my databases. Its name contains a hyphen, which seems to be the problem, although the USE statement accepts the database name.

I am using version 3.23.43.
 
have you tried the backtick ` around the database name like this:

Code:
drop database `databasename`
 
I have just tried single and double quotes around the database name and I still get the syntax error.

I have found that deleting the files and directory from the data directory seems to work
 
Single or Double quotes will probably not work. The backtick that quelphdad suggested is not the same as a single or double quote.

I'm using MySQL v5.0.13 and the MySQL Query Browser would not allow me to do
Code:
create database scrap-it
But it would allow me to
Code:
create database `scrap-it`
The same applied to dropping the database. So I suggest you try quelphdad's suggestion and use back ticks.

Andrew
Hampshire, UK
 
Back ticks worked, thanks very much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top