[ACCEPTED]-how to drop database-database-administration

Accepted answer
Score: 24

It means there are files in that directory 3 not relating to MySQL. Another issue, although 2 I doubt it, is insufficient permissions. You 1 may delete that directory from the filesystem.

Score: 14

Got same error. This fixed it for me in 2 Ubuntu 10.04:

stop mysql

rm -rf /var/lib/mysql/XXXXX

start mysql

Where XXXXX is the offending 1 database name.

Score: 7

sudo rm -rf /var/lib/mysql/db_production

where db_production 2 is the name of the database

Remember to use 1 "sudo".

Score: 1

I've changed the permissions on mysql folder 3 ( windows server c:\xampp\mysql ) and is working now, I've 2 created and dropped databases without any 1 error.

Score: 1

This is what I do on Mac OS X Mavericks:

  1. Stop the MySQL service
  2. Remove the directory at /usr/local/mysql/data


Score: 1

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 2 help, Attention , direct remove data dir is useless, whatever you restart 1 mysqld or not .

Score: 1

Here is a way to simulate your error

1.create 4 a directory on MySQL data directory

mkdir /data/mysql/data/filmo

2.check 3 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 2 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 1 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)
Score: 1

This is amazingly old, but another thing 11 to check is the data folder. On Windows, that 10 should be C:\ProgramData\MySQL<Version>\Data. IN 9 my case, I was getting a 'cannot find folder' error.

I 8 found that somehow the data folder for my 7 database had been deleted. I imagine it 6 was user error. I added a blank folder with 5 the database name, and when I went back 4 the DROP the table, it went as expected. Took 3 me a while to find out what had happened, but 2 hopefully this will save someone else the 1 heartache.

Score: 0

do you have write permission on that directory 4 (and the parent)? you may need to recursively 3 make the directory writable (security tab 2 in windows or chmod in nix) and delete any 1 non-db files like "Thumbs.db"

Score: 0

I had this problem and it seems to be about 4 your mysql user permissions. try doing it 3 by root user if it did work use this command 2 as root to grand drop permission to your 1 user:

grant drop
execute on *.* to 'your-user-name'@'user-ip';
Score: 0

That error usually comes when you have wrong 11 TABLESPACE in ibdata1 file (that's for innodb 10 engine) innodb engine store some settings 9 inside ibdata1 file

if you have recently 8 copied / moved your files to other server 7 or tried to restore then you should move 6 ibdata1 file aswell then you can delete 5 the db. I assume you are having issue like 4 table doesn't exist and now deleting db? if 3 yes then stop mysql service then delete 2 files and then create db again, that will 1 help you. Further here this might help you [Error Dropping Database (Can&#39;t rmdir &#39;.test\&#39;, errno: 17)

Score: 0

Not sure where I got this answer from (apologies) but, although 10 similar to the above, it has the additional 9 info of how to find the mysql data directory:

mysql 8 -e "select @@datadir"

This, I assume, is 7 generic and returns the path to mysql/data. If 6 you move to that directory (unix/linux/macOS 5 command):

cd path_to_mysql/data

you will find the 4 database you want to remove, which on nix 3 can be done by:

sudo rm -rf DB_NAME

On MacOS X (10.9.5) I 2 did not have to stop MySQL, but this may differ 1 on other platforms.

More Related questions