Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Disclaimer: not an administrator

How does one deal with non-kosher names such as 'data?base' ?

I'm always one to ensure the cleanliness of my databases, but after finally installing phpmyadmin to aid in my mysql server (where before it was all manual). I seemed to have slipped up.

I logged in remotely through a limited access account and saw an option create a database. Thinking that I disabled create on that account, I went ahead and selected that option expecting and error. Nope, it actually worked, so I revoked access as well as double checked my permissions before I came to the quandry of removing the database.

The original database was named sig_db5 which phpmyadmin left as sig?db5 in the create database option (the default name in that context).

mysql> drop database 'sig?db5';

yeilds to

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 ''sig?db5'' at line 1

I can assure you that the database does indeed exist, but I'm in disbelief that if I can't remove it due to that character, how the heck did it get created.

+---------------------+
| Database            |
+---------------------+
| ******************  | 
| ******************  |
| sig?db5             | 
| ******************  |
| ******************  |
| ******************  | 
| ******************  | 
| ******************  | 
| ******************  | 
+---------------------+

(censured other names)

share|improve this question
    
Did you try using "" or [] for the db name? –  Marian Feb 21 '11 at 19:07
add comment

1 Answer

up vote 3 down vote accepted

Disclaimer : not a user of phpmyadmin

You may have to check the following

  1. see what character set phpmyadmin operates in
  2. see what character set mysqld operates in
  3. see what character set remote database servers operates in

Find out if you can manually change the default character set before connecting to the the desired DB server

If you connect to a remote DB using mysql client program and the characters for DB names look normal, then you are just dealing with character set issues with phpmyadmin.

WIth regard to the error message, do not surround database names with single quotes ('). Instead, surround them with back quotes (`)

share|improve this answer
1  
You were spot on about the character set. It apparently put in some weird UTF character in there that I couldn't replicate. Fortunately, phpmyadmin had an in-house rename which allowed me to rename the database to 'deleteme' and the rest was history. –  Ken Feb 21 '11 at 20:11
add comment

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.