Symptoms

Drop database task fails with the error:

Task name       Drop database db123456_dbname on host 192.168.10.100
Last execution output   MySQL API error: Error dropping database (can't rmdir './db123456_dbname', errno: 39).

At the same time it looks like database is already empty - attempt to drop it manually fails as well with the same error:

mysql> DROP DATABASE db123456_dbname;
ERROR 1010 (HY000): Error dropping database (can't rmdir './db123456_dbname', errno: 39)

mysql> use db123456_dbname;
Database changed

mysql> show tables;
Empty set (0.00 sec)

Cause

Database files were manually copied to the server, and folder /var/lib/mysql/db123456_dbname actually contains a database:

# du -hsx /var/lib/mysql/db123456_dbname
20M     /var/lib/mysql/db123456_dbname

of which MySQL is not aware of.

Resolution

Backup database folder /var/lib/mysql/db123456_dbname, delete files from /var/lib/mysql/db123456_dbname and then restart the failed task.

Internal content