Drop database return "Error dropping database errno: 66" in MySQL
Asked Answered
G

3

50

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?

Gon answered 13/5, 2013 at 16:40 Comment(2)
datadir= in my.cnf should point you to your data directory.Haitian
I just want to point out that happened to me in phpmyadmin with case-sensitive database name, for example if I try to drop my_DATAbase I can see that error. The folder name is my_DATAbase but phpmyadmin is trying to delete the folder my_database.Interjacent
S
113
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)

Stave answered 13/5, 2013 at 16:52 Comment(10)
Hello, the first point - I get only /usr/local/bin/mysql, cd /usr/local/bin/mysql => Not a directoryGon
You have your mysql in a different directory...then check datadir= in my.cnf should point you to your data directoryStave
How can I display it? Where is it located?Gon
Here are possible locations of the my.cnf file for version 5.5 on Mac OS X: /etc/my.cnf /etc/mysql/my.cnf SYSCONFDIR/my.cnf $MYSQL_HOME/my.cnf defaults-extra-file (the file specified with --defaults-extra-file=path, if any) ~/.my.cnfStave
Just incase you face issue deleting the folder because of permission issues you may do that as an admin/root user. It worked for me. Thanks RobertBowens
mysql -e "select @@datadir"Biogen
In my case i'm running in local AMPPS and i have the same problem. The only way to fix it was to manually delete the database folder in /Applications/AMPPS/var/ "the-folder-nameo-db"Galton
Type: mysql -e "select @@datadir" This will show you where your database(s) exist. Goto that folder shown from the command above. Delete the corrupted db by typing: rm -rf yourDbName Thank you @Robert RozasRevile
If you get an access denied error, you have to execute this command as a root user (or an user with root access): mysql -u root -p -e "select @@datadir" you will be asked for your password, after that the datadir will show up.Sternutation
On OSX, my database folders are in my database directory, i.e. /usr/local/var/mysql/ not in a data subdirectory. Deleting these solved my issue.Warrantable
V
6

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

/Applications/XAMPP/xamppfiles/var/mysql
Vedi answered 29/4, 2016 at 4:55 Comment(0)
F
0

FYI for mac users with normal mysql server:

/usr/local/mysql/bin/mysql -u root -pPASSWORD  -e "select @@datadir"
Flyboat answered 7/2, 2017 at 11:55 Comment(1)
How would this drop the a db table?Warrantable

© 2022 - 2024 — McMap. All rights reserved.