如何删除数据库
我使用了以下 sytanx
drop database filmo;
并收到以下错误:
ERROR 1010 (HY000): Error dropping database (can't rmdir './filmo/', errno: 17)
任何想法..
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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(13)
这意味着该目录中存在与 MySQL 无关的文件。另一个问题(尽管我对此表示怀疑)是权限不足。您可以从文件系统中删除该目录。
It means there are files in that directory not relating to MySQL. Another issue, although I doubt it, is insufficient permissions. You may delete that directory from the filesystem.
遇到同样的错误。这在 Ubuntu 10.04 中为我解决了这个问题:
stop mysql
rm -rf /var/lib/mysql/XXXXX
start mysql
其中 XXXXX 是有问题的数据库名称。
Got same error. This fixed it for me in Ubuntu 10.04:
stop mysql
rm -rf /var/lib/mysql/XXXXX
start mysql
Where XXXXX is the offending database name.
sudo rm -rf /var/lib/mysql/db_product
其中
db_product 是数据库的名称,
请记住使用“sudo”。
sudo rm -rf /var/lib/mysql/db_production
where
db_production is the name of the database
Remember to use "sudo".
我已经更改了 mysql 文件夹( windows server
c:\xampp\mysql
)的权限并且现在正在工作,我已经创建并删除了数据库,没有任何错误。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.这就是我在 Mac OS X Mavericks 上所做的:
/usr/local/mysql/data
目录This is what I do on Mac OS X Mavericks:
/usr/local/mysql/data
1) rm -rf /var/lib/mysql/data/***
保留数据目录,rm数据内容/
2)使用
后重新创建数据数据库就可以了。
希望它会有所帮助,
注意,无论你是否重新启动mysqld,直接删除数据目录是没有用的。
1)
rm -rf /var/lib/mysql/data/***
keep the data dir , rm the contents of data/
2) use
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 .
这是模拟错误的方法
1.在 MySQL 数据目录上创建一个目录
2.检查最后一项
3.在其中创建转储文件
4.MySQL 会认为 filmo 是一个数据库
5.当我删除这个“数据库”时,这是你的错误
Here is a way to simulate your error
1.create a directory on MySQL data directory
2.check the last item
3.create a dump file in it
4.MySQL will believe filmo is a database
5.when I drop this "database",here is your error
这是令人惊讶的旧,但另一件事要检查的是数据文件夹。在 Windows 上,该位置应为 C:\ProgramData\MySQL\Data。就我而言,我收到“找不到文件夹”错误。
我发现我的数据库的数据文件夹已被删除。我想这是用户错误。我添加了一个带有数据库名称的空白文件夹,当我返回 DROP 表时,它按预期进行。我花了一段时间才弄清楚发生了什么事,但希望这能减轻其他人的心痛。
This is amazingly old, but another thing to check is the data folder. On Windows, that should be C:\ProgramData\MySQL<Version>\Data. IN my case, I was getting a 'cannot find folder' error.
I found that somehow the data folder for my database had been deleted. I imagine it was user error. I added a blank folder with the database name, and when I went back the DROP the table, it went as expected. Took me a while to find out what had happened, but hopefully this will save someone else the heartache.
您对该目录(及其父目录)有写权限吗?您可能需要递归地使目录可写(Windows 中的安全选项卡或 nix 中的 chmod)并删除任何非数据库文件,例如“Thumbs.db”
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"
我遇到了这个问题,这似乎与您的 mysql 用户权限有关。
尝试由 root 用户执行此操作(如果确实有效),请以 root 身份使用此命令来将权限授予您的用户:
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:
当 ibdata1 文件(用于 innodb 引擎)中的表空间错误时,通常会出现该错误
innodb 引擎在 ibdata1 文件中存储一些设置,
如果您最近将文件复制/移动到其他服务器或尝试恢复,那么您也应该移动 ibdata1 文件,然后您可以删除数据库。
我假设您遇到类似表不存在而现在删除数据库的问题?
如果是,则停止 mysql 服务,然后删除文件,然后再次创建数据库,这会对您有所帮助。
此外,这可能会对您有所帮助
[删除数据库时出错(无法 rmdir '.test\',错误号:17)
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)
不确定我从哪里得到这个答案(抱歉),但是,尽管与上面类似,它具有如何查找 mysql 数据目录的附加信息:
我认为这是通用的,并返回 mysql/data 的路径。如果移动到该目录(unix/linux/macOS 命令):
你会找到你想要删除的数据库,在 nix 上可以通过以下方式完成:
在 MacOS X (10.9.5) 上,我不必必须停止 MySQL,但这在其他平台上可能有所不同。
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:
This, I assume, is generic and returns the path to mysql/data. If you move to that directory (unix/linux/macOS command):
you will find the database you want to remove, which on nix can be done by:
On MacOS X (10.9.5) I did not have to stop MySQL, but this may differ on other platforms.