Mysql – databases/tables with nonconventional names

MySQL

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)

Best Answer

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 (`)