mysql> drop database testdb;
ERROR 1010 (HY000): Error dropping database (can’t rmdir ‘./testdb/’, errno: 17)
mysql> select @@datadir;
+————————+
| @ @ datadir |
+————————+
| /usr/local/mysql/data/ |
+————————+
1 row in set (0.00 SEC)
The reason is that there are files other than database files in the directory of data /usr/local/mysql/data/. You can CD to its directory after clearing it out. Drop again
[root-@localhost104 testdb]# CD testdb
[root-@localhost104 testdb]# ll
total 0
-rw-r — r-1 root root 0 Jul 23 10:22 delete.txt
[root-@localhost104 testdb]# rm delete.txt
rm: Remove regular empty File ‘delete.txt’?yes
mysql> drop database testdb;
Query OK, 0 rows affected (0.06 SEC)
The database directory cannot hold files unrelated to the database!
ERROR 1010 (HY000): Error dropping database (can’t rmdir ‘./testdb/’, errno: 17)
mysql> select @@datadir;
+————————+
| @ @ datadir |
+————————+
| /usr/local/mysql/data/ |
+————————+
1 row in set (0.00 SEC)
The reason is that there are files other than database files in the directory of data /usr/local/mysql/data/. You can CD to its directory after clearing it out. Drop again
[root-@localhost104 testdb]# CD testdb
[root-@localhost104 testdb]# ll
total 0
-rw-r — r-1 root root 0 Jul 23 10:22 delete.txt
[root-@localhost104 testdb]# rm delete.txt
rm: Remove regular empty File ‘delete.txt’?yes
mysql> drop database testdb;
Query OK, 0 rows affected (0.06 SEC)
The database directory cannot hold files unrelated to the database!
Read More:
- The problem of master-slave database synchronization stop caused by MySQL deleting data
- Oracle can’t start the database due to deleting DBF file by mistake
- Encapsulation of adding, deleting and modifying database by JDBC
- ERROR 1010 (HY000): Error dropping database (can’t rmdir ‘./myapp’, errno: 39)
- Mysql start slave error 1201 (HY000)
- [MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘
- An error is reported when kettle connects Oracle database and MySQL database
- Solve MySQL installation error: initializing database prompts an error when installing mysql
- How to solve MySQL error 1049 (42000): unknown database ‘database’
- Solution to error 2002 (HY000) in MySQL login startup
- Solve MySQL error 2002 (HY000)
- SQL exception handling – MySQL error 1005 (HY000): can’t create table ‘TMP’ (errno: 13)
- ERROR 2005 (HY000): Unknown MySQL server host
- Error 2005 (HY000) unkonw MySQL server host…
- (error when importing database): MySQL 2006-mysql server has gone away
- Solution to error 2002 (HY000) in MySQL
- MYSQL:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
- ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- MySQL error 1205 (HY000): lock wait timeout exceeded; try restarting transaction
- Error 2003 (HY000): can’t connect to MySQL server on ‘localhost’ (10061)