how to drop database

2020-02-23 06:52发布

i used the following sytanx

drop database filmo; 

and got the following error:

ERROR 1010 (HY000): Error dropping database (can't rmdir './filmo/', errno: 17)

any ideas..

12条回答
可以哭但决不认输i
2楼-- · 2020-02-23 07:01

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)

查看更多
Lonely孤独者°
3楼-- · 2020-02-23 07:01

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';
查看更多
\"骚年 ilove
4楼-- · 2020-02-23 07:02

This is what I do on Mac OS X Mavericks:

  1. Stop the MySQL service
  2. Remove the directory at /usr/local/mysql/data
查看更多
We Are One
5楼-- · 2020-02-23 07:03
drop database <database_name>;
查看更多
淡お忘
6楼-- · 2020-02-23 07:04

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

查看更多
劳资没心,怎么记你
7楼-- · 2020-02-23 07:07

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.

查看更多
登录 后发表回答