Drop database return "Error dropping database errno: 66" in MySQL

MysqlOsx LionRootDrop Database

Mysql Problem Overview


Consider:

DROP DATABASE db_name;
ERROR 1010 (HY000): Error dropping database (can't rmdir './db_name', errno: 66)

The problem is that I don't know where the file/directory is located - this file is missing in /usr/local/mysql/bin/...

How do I fix this issue?

Mysql Solutions


Solution 1 - Mysql

mysql> drop database DB_NAME; 
ERROR 1010 (HY000): Error dropping database 
(can't rmdir './DB_NAME', errno: 66)
  1. Find the database directory: mysql -e "select @@datadir" -> /usr/local/mysql/data/

  2. Go to the DataBase folder: cd /usr/local/mysql/data/

  3. Delete DB folder of the DB with the issue (in this case: sudo rm -rf DB_NAME)

Solution 2 - Mysql

If you are using XAMPP in OSX the data directory would be at

/Applications/XAMPP/xamppfiles/var/mysql

Solution 3 - Mysql

FYI for mac users with normal mysql server:

/usr/local/mysql/bin/mysql -u root -pPASSWORD  -e "select @@datadir"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser984621View Question on Stackoverflow
Solution 1 - MysqlHackermanView Answer on Stackoverflow
Solution 2 - MysqlkbokdiaView Answer on Stackoverflow
Solution 3 - MysqlBjørson BjørsonView Answer on Stackoverflow