October 26 2013

Can’t drop database ‘dbname’; database doesn’t exist and database exists

Tagged Under : ,

MySQL
Recently I reinstall MySQL Database because it suddenly cannot start and it crash. After I successful reinstall, I found an extra database in MySQL Server.

When I tried to drop the database, I received the following error:
“Can’t drop database ‘dbname’; database doesn’t exist”
And when I tried to create a new database with same name, it told me:
“Can’t create database ‘dbname’; database exists”
That just didn’t make any sense! And the PHPMyAdmin application still listed the database in the Catalog list.

To fix it was simple. navigate to the MySQL data directory and then remove the folder for the problem database. Now the database disable from the Catalog list and able to create the database.

Windows and Linux Mysql Server Data directory are different.
for Linux it will be at:
/var/lib/mysql/
Windows will be at:
C:\ProgramData\MySQL\MySQL Server 5.5\Data\
If you are using WAMP the directory will be at:
C:\wamp\bin\mysql\mysql5.1.53\data

Make a Comment

You must be logged in to post a comment.