MySQL5.5.20 中删除test数据库时遇到如下错误,ERROR 1010 (HY000) at line 1: Error dropping database (can't rmdir './test/', errno: 17)
mysql> select VERSION();
+------------+
| VERSION() |
+------------+
| 5.5.20-log |
+------------+
1 row in set
$./mysql_secure_installation
Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1010 (HY000) at line 1: Error dropping database (can't rmdir './test/', errno: 17)
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
原来在mysql 的data/test中有隐藏文件.empth, 手工删除这个隐藏文件后可以drop掉test库。
$ls -la
total 20
drwxrwxr-x 2 mysql mysql 4096 2014-12-17 15:03:27 .
drwxrwxr-x 10 mysql mysql 4096 2015-01-13 01:12:13 ..
-rw-r--r-- 1 mysql mysql 0 2012-06-18 18:40:07 .empty
$rm -rf .empty
mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)