MySQL : Error Dropping Database (Can’t rmdir ‘.test\’, errno: 17)

Posted: December 19, 2016 in Database, MySQL
Tags: , , ,

Recently, i got the following error while trying to drop a schema. After few minutes of searching, i found a solution for this which I would like to share with you all.

Root Cause: The DROP DATABASE statement will remove all table files and then remove the directory that represented the database. It will not, however, remove non-table files, whereby making it not possible to remove the directory.

Solution : We have to drop the database manually by removing any remaining files in the database directory and then the directory itself.

Go to the datadir for your mysql installation and rm the databases manually.

$ cd /usr/local/var/mysql
$ ls (you can find your schema as a folder here)
$ sudo rm -r suhasjavablogSchema // Force schema drop from here.
  1. Keyhan says:

    Thanks for the suggestion.
    But in Ubuntu, the path is /var/lib/mysql

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s