mrkernelpanic
mrkernelpanic

Reputation: 4451

mysql drop database which exists with same name

I have got a weird state in my mysql/ mariadb server.

When I execute show databases; it gets following result:

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| MYDATABASENAME         |
| mydatabasename         |

And when I execute drop database MYDATABASENAME; then the database mydatabasename lowercase one gets dropped and not the uppercase one. If I then execute the drop database MYDATABASENAME; again it says

ERROR 1008 (HY000): Can't drop database 'mydatabasename'; database doesn't exist

UPDATE

In my.cnf I had set lower_case_table_names=1 which caused the mysql server to handle all tables/ databases in lower case format. See my answer below.

My question is now, how can I drop the uppercase database "MYDATABASENAME"?

Upvotes: 0

Views: 703

Answers (2)

Rick James
Rick James

Reputation: 142366

It is best not to try to override the OS-based default value for lower_case_table_names.

MySQL/MariaDB depend on file and directory names based on table and database names. But Windows ignores case; *nix does not.

Upvotes: 0

mrkernelpanic
mrkernelpanic

Reputation: 4451

If you have set lower_case_table_names=1 in your my.cnf then mysql handles/ stores all tables and databases in lower case format. So disabling the property, then executing the drop command again fixed the problem.

Upvotes: 2

Related Questions