Can't rmdir './mydatabase', Errno: 39

Last modified: 
Sunday, June 28th, 2015


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.idd
mysql> drop database mydatabase;
Query OK, 0 rows affected (0.00 sec)


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.