Issue
Mysql drop table command returns:
ERROR 1010 (HY000): Error dropping database (can't rmdir './mydatabase', errno: 39)
Likely Cause
There is a file in the database folder which isn't being managed by Mysql. This file could be hidden detritus or, more likely, an orphaned .ibd file.
# cd /var/log/mysql/mydatabase
# ls -la
total 72
drwx------ 2 mysql mysql 4096 Jun 23 19:57 ./
drwx------ 7 mysql mysql 4096 Jun 23 21:08 ../
-rw-rw---- 1 mysql mysql 65536 Jun 23 19:56 actions.ibd
Something Like a Solution
I just delete the problem file and run the database drop command again.
# rm -f actions.iddmysql> drop database mydatabase;
Query OK, 0 rows affected (0.00 sec)
References