i used the following sytanx
drop database filmo;
and got the following error:
ERROR 1010 (HY000): Error dropping database
Here is a way to simulate your error
1.create a directory on MySQL data directory
mkdir /data/mysql/data/filmo
2.check the last item
[root@linux]# ls -ltrh /data/mysql/data/
总用量 173M
-rw-rw---- 1 mysql mysql 48M 4月 17 11:00 ib_logfile1
drwx------ 2 mysql mysql 4.0K 4月 17 11:00 performance_schema
drwx------ 2 mysql mysql 4.0K 4月 17 11:00 mysql
-rw-rw---- 1 mysql mysql 56 4月 18 06:01 auto.cnf
drwxr-xr-x 2 root root 4.0K 4月 18 07:25 backup
-rw-rw---- 1 mysql mysql 19 4月 23 07:29 mysql-bin.index
-rw-rw---- 1 mysql mysql 5 4月 23 07:29 oldboylinux.pid
-rw-rw---- 1 mysql mysql 19K 4月 23 07:29 error.log
-rw-rw---- 1 mysql mysql 76M 4月 23 09:56 ibdata1
-rw-rw---- 1 mysql mysql 48M 4月 23 09:56 ib_logfile0
-rw-rw---- 1 mysql mysql 5.9K 4月 23 10:21 mysql-bin.000001
drwxr-xr-x 2 root root 4.0K 4月 23 10:36 filmo
3.create a dump file in it
[root@linux]# mysqldump -uroot -p123456 -B mysql>/data/mysql/data/filmo/dump_file.sql
4.MySQL will believe filmo is a database
[root@linux]# mysql -uroot -p123456 -e"show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| backup |
| filmo |
| mysql |
| performance_schema |
+--------------------+
5.when I drop this "database",here is your error
[root@linux]# mysql -uroot -p123456 -e"drop database filmo;"
ERROR 1010 (HY000) at line 1: Error dropping database (can't rmdir './filmo/', errno: 17)
I had this problem and it seems to be about your mysql user permissions. try doing it by root user if it did work use this command as root to grand drop permission to your user:
grant drop
execute on *.* to 'your-user-name'@'user-ip';
1) rm -rf /var/lib/mysql/data/***
keep the data dir , rm the contents of data/
2) use
mysql -uxxx -pyyy
$ drop database data;
then it would be ok to recreate the data database again. hopefully it will help, Attention , direct remove data dir is useless, whatever you restart mysqld or not .
That error usually comes when you have wrong TABLESPACE in ibdata1 file (that's for innodb engine) innodb engine store some settings inside ibdata1 file
if you have recently copied / moved your files to other server or tried to restore then you should move ibdata1 file aswell then you can delete the db. I assume you are having issue like table doesn't exist and now deleting db? if yes then stop mysql service then delete files and then create db again, that will help you. Further here this might help you [Error Dropping Database (Can't rmdir '.test\', errno: 17)
do you have write permission on that directory (and the parent)? you may need to recursively make the directory writable (security tab in windows or chmod in nix) and delete any non-db files like "Thumbs.db"
Not sure where I got this answer from (apologies) but, although similar to the above, it has the additional info of how to find the mysql data directory:
mysql -e "select @@datadir"
This, I assume, is generic and returns the path to mysql/data. If you move to that directory (unix/linux/macOS command):
cd path_to_mysql/data
you will find the database you want to remove, which on nix can be done by:
sudo rm -rf DB_NAME
On MacOS X (10.9.5) I did not have to stop MySQL, but this may differ on other platforms.