错误删除数据库(不能rmdir)。测试\ ',errno:17)

时间:2022-03-20 21:11:31

Basically, I was taught on how to create a root password using the "mysqladmin -u root -p password" command, this was done all through the windows command editor. Now, the next process was to display the default databases (info. schema, mysql and test) which was achieved by using "SHOW DATABASES;"

基本上,我学习了如何使用“mysqladmin -u root -p密码”命令创建根密码,这是通过windows命令编辑器完成的。现在,下一个过程是显示默认数据库(info)。使用“显示数据库”实现的模式、mysql和测试)

But according to the book, we had to delete the redundant test file and the following error pops up:

但是根据这本书,我们必须删除冗余的测试文件,然后弹出如下错误:

Error Dropping Database (Can't rmdir '.test\', errno: 17)

错误删除数据库(不能rmdir)。测试\ ',errno:17)

The command put to use was DROP DATABASE test;

使用的命令是DROP DATABASE test;

I am using MYSQL and PHPMYADMIN. Any help on how to drop the file with no errors?

我使用的是MYSQL和PHPMYADMIN。对于如何删除没有错误的文件有任何帮助吗?

13 个解决方案

#1


134  

A database is represented by a directory under the data directory, and the directory is intended for storage of table data.

数据库由数据目录下的目录表示,目录用于存储表数据。

The DROP DATABASE statement will remove all table files and then remove the directory that represented the database. It will not, however, remove non-table files, whereby making it not possible to remove the directory.

DROP数据库语句将删除所有表文件,然后删除表示数据库的目录。但是,它不会删除非表文件,因此无法删除该目录。

MySQL displays an error message when it cannot remove the directory

MySQL在无法删除目录时显示错误消息。

you can really drop the database manually by removing any remaining files in the database directory and then the directory itself.

您可以通过删除数据库目录中的任何剩余文件和目录本身来手动删除数据库。

#2


37  

I ran into this same issue on a new install of mysql 5.5 on a mac. I tried to drop the test schema and got an errno 17 message. errno 17 is the error returned by some posix os functions indicating that a file exists where it should not. In the data directory, I found a strange file ".empty":

我在mac上的一个新安装的mysql 5.5上遇到了同样的问题,我试图删除测试模式,并得到了一个errno 17消息。errno 17是一些posix os函数返回的错误,表示文件存在不应该存在的位置。在数据目录中,我发现了一个奇怪的文件“。empty”:

sh-3.2# ls -la data/test
total 0
drwxr-xr-x   3 _mysql  wheel  102 Apr 15 12:36 .
drwxr-xr-x  11 _mysql  wheel  374 Apr 15 12:28 ..
-rw-r--r--   1 _mysql  wheel    0 Mar 31 10:19 .empty

Once I rm'd the .empty file, the drop database command succeeded.

一旦我打开.empty文件,drop数据库命令就成功了。

I don't know where the .empty file came from; as noted, this was a new mysql install. Perhaps something went wrong in the install process.

我不知道。空文件是从哪里来的;如前所述,这是一个新的mysql安装。可能在安装过程中出现了问题。

#3


24  

Go to the datadir for your mysql installation and rm the databases manually. It can be

请到datadir为您的mysql安装和rm手动创建数据库。它可以

/usr/local/var/mysql

Then,

然后,

rm -R <Your DB name>

To check datadir for your installation,

为您的安装检查datadir,

vim the mysql.server file and find it there.

#4


22  

For phpmyadmin, go to xampp\mysql\data and simply delete the database folder. Worked for me !!

对于phpmyadmin,访问xampp\mysql\数据并简单地删除数据库文件夹。为我工作!

#5


9  

If it is XAMPP, Do the following:

如果是XAMPP,请执行以下步骤:

cd /opt/lampp/var/mysql;
sudo su;
rm -rf test;

Hope this helps.

希望这个有帮助。

#6


7  

I just ran into this problem with WAMP and the phpMyAdmin that comes with it. To remove the database and make the error go away. I went into C:\wamp\bin\mysql\mysql5.5.24\data\ and deleted the folder for the database in question.

我和WAMP和phpMyAdmin一起遇到了这个问题。删除数据库并使错误消失。我进入了C:\wamp\bin\mysql\mysql5.5.24\数据\,并删除了数据库的文件夹。

Then I refreshed the page at phpMyAdmin, and the database was gone.

然后我刷新了phpMyAdmin的页面,数据库就消失了。

#7


0  

In my case I didn't see any tables under my database on phpMyAdmin I am using Wamp server but when I checked the directory under C:\wamp\bin\mysql\mysql5.6.12\data I found this employed.ibd when I deleted this file manually I was able to drop the database from phpMyAdmin smoothly without any problems.

在我的情况下,我在phpMyAdmin的数据库中没有看到任何表,我使用的是Wamp服务器,但当我检查C:\ Wamp \bin\mysql\mysql5.6.12\的目录时,我找到了这个工作。当我手动删除这个文件时,我能够顺利地从phpMyAdmin删除数据库,没有任何问题。

#8


0  

I my case the problem was a residual dump file in the database directory. That file was probably generated during a backup script test I had been working on. Once I manually deleted the file I could then drop the database.

我的情况是,问题是数据库目录中的一个剩余转储文件。这个文件很可能是在我正在进行的备份脚本测试期间生成的。一旦我手动删除了文件,我就可以删除数据库。

#9


0  

I had the same issue (mysql 5.6 on mac) with 'can't rmdir..'-errors when dropping databases. Leaving an empty database directory not possible to get rid of. Thanks @Framework and @Beel for the solutions.

我有同样的问题(mac上的mysql 5.6),不能使用rmdir。删除数据库时的错误。留下一个空的数据库目录,不可能删除。感谢@Framework和@Beel解决方案。

I first deleted the db directory from the Terminal in (/Applications/XAMPP/xamppfiles/var/mysql).

我首先从终端(/应用程序/XAMPP/xamppfiles/var/mysql)删除了db目录。

For further db drops, I also deleted the empty test file. In my case the file was called NOTEMPTY but still containing 0:

对于进一步的db下降,我也删除了空的测试文件。在我的案例中,这个文件被称为NOTEMPTY,但仍然包含0:

sudo ls -al test
total 0
drwxrwx---   3 _mysql  _mysql  102 Mar 26 16:50 .
drwxrwxr-x  18 _mysql  _mysql  612 Apr  7 13:34 ..
-rw-rw----   1 _mysql  _mysql    0 Jun 26  2013 NOTEMPTY

Chmod first and then

修改文件权限,然后

sudo rm -rf test/NOTEMPTY

No problems dropping databases after that

在此之后,删除数据库没有问题。

#10


0  

just go to data directory in my case path is "wamp\bin\mysql\mysql5.6.17\data" here you will see all databases folder just delete this your database folder the db will automatically drooped :)

在我的案例路径中去到数据目录是"wamp\bin\mysql\mysql5.6.17\data"这里你会看到所有数据库文件夹都删除了这个数据库文件夹,db会自动下降:)

#11


0  

You can delete the data in the sql directory.

您可以删除sql目录中的数据。

For me i was using AMPPS on windows 10. I went to the AMPPs installtion directory. for me it was :

对我来说,我在windows 10上使用AMPPS。我去了AMPPs安装目录。对我来说,它是:

D:\Program Files (x86)\Ampps\mysql\data

because i have it installed on my secondary drive.

因为我把它安装在我的辅助硬盘上了。

Then refresh your SQL client and you will see it's gone.

然后刷新您的SQL客户机,您将看到它已经消失。

#12


0  

You may need to check two things.

您可能需要检查两件事情。

1- Database Foleder's permission The database you wants to delete must have the same owner as mysql process has.

1-数据库Foleder的权限,你想要删除的数据库必须拥有与mysql进程相同的所有者。

2- Directory Must be empty Goto the mysql data directory and verify that directory is empty

2-目录必须是空的Goto mysql数据目录,并验证该目录是空的。

After that connect your mysql cli and run drop database command again.

之后连接mysql cli并再次运行drop database命令。

#13


0  

Just to add to the responses so far: In Windows 10, the data files are kept here...

只是为了添加到目前为止的响应:在Windows 10中,数据文件保存在这里……

C:\ProgramData\MySQL\MySQL Server [m.n]\data

C:\ ProgramData MySQL \ MySQL服务器(梅西百货(m.n:行情)\ \数据

There will be directories for each schema in your database. You will want to go inside the schema you are trying to drop, manually delete any superfluous files then try the drop command again.

您的数据库中将有每个模式的目录。您将希望进入正在尝试删除的模式中,手动删除任何多余的文件,然后再次尝试删除命令。

Any workbench changes against a database will get stored in this location. For example, I had this error following a reverse engineering exercise on one of my databases and saving the changes which get stored in a .mwb file in this location.

任何针对数据库的工作台更改都会被存储在这个位置。例如,我在我的一个数据库上进行逆向工程练习,并保存了在这个位置的.mwb文件中存储的更改。

#1


134  

A database is represented by a directory under the data directory, and the directory is intended for storage of table data.

数据库由数据目录下的目录表示,目录用于存储表数据。

The DROP DATABASE statement will remove all table files and then remove the directory that represented the database. It will not, however, remove non-table files, whereby making it not possible to remove the directory.

DROP数据库语句将删除所有表文件,然后删除表示数据库的目录。但是,它不会删除非表文件,因此无法删除该目录。

MySQL displays an error message when it cannot remove the directory

MySQL在无法删除目录时显示错误消息。

you can really drop the database manually by removing any remaining files in the database directory and then the directory itself.

您可以通过删除数据库目录中的任何剩余文件和目录本身来手动删除数据库。

#2


37  

I ran into this same issue on a new install of mysql 5.5 on a mac. I tried to drop the test schema and got an errno 17 message. errno 17 is the error returned by some posix os functions indicating that a file exists where it should not. In the data directory, I found a strange file ".empty":

我在mac上的一个新安装的mysql 5.5上遇到了同样的问题,我试图删除测试模式,并得到了一个errno 17消息。errno 17是一些posix os函数返回的错误,表示文件存在不应该存在的位置。在数据目录中,我发现了一个奇怪的文件“。empty”:

sh-3.2# ls -la data/test
total 0
drwxr-xr-x   3 _mysql  wheel  102 Apr 15 12:36 .
drwxr-xr-x  11 _mysql  wheel  374 Apr 15 12:28 ..
-rw-r--r--   1 _mysql  wheel    0 Mar 31 10:19 .empty

Once I rm'd the .empty file, the drop database command succeeded.

一旦我打开.empty文件,drop数据库命令就成功了。

I don't know where the .empty file came from; as noted, this was a new mysql install. Perhaps something went wrong in the install process.

我不知道。空文件是从哪里来的;如前所述,这是一个新的mysql安装。可能在安装过程中出现了问题。

#3


24  

Go to the datadir for your mysql installation and rm the databases manually. It can be

请到datadir为您的mysql安装和rm手动创建数据库。它可以

/usr/local/var/mysql

Then,

然后,

rm -R <Your DB name>

To check datadir for your installation,

为您的安装检查datadir,

vim the mysql.server file and find it there.

#4


22  

For phpmyadmin, go to xampp\mysql\data and simply delete the database folder. Worked for me !!

对于phpmyadmin,访问xampp\mysql\数据并简单地删除数据库文件夹。为我工作!

#5


9  

If it is XAMPP, Do the following:

如果是XAMPP,请执行以下步骤:

cd /opt/lampp/var/mysql;
sudo su;
rm -rf test;

Hope this helps.

希望这个有帮助。

#6


7  

I just ran into this problem with WAMP and the phpMyAdmin that comes with it. To remove the database and make the error go away. I went into C:\wamp\bin\mysql\mysql5.5.24\data\ and deleted the folder for the database in question.

我和WAMP和phpMyAdmin一起遇到了这个问题。删除数据库并使错误消失。我进入了C:\wamp\bin\mysql\mysql5.5.24\数据\,并删除了数据库的文件夹。

Then I refreshed the page at phpMyAdmin, and the database was gone.

然后我刷新了phpMyAdmin的页面,数据库就消失了。

#7


0  

In my case I didn't see any tables under my database on phpMyAdmin I am using Wamp server but when I checked the directory under C:\wamp\bin\mysql\mysql5.6.12\data I found this employed.ibd when I deleted this file manually I was able to drop the database from phpMyAdmin smoothly without any problems.

在我的情况下,我在phpMyAdmin的数据库中没有看到任何表,我使用的是Wamp服务器,但当我检查C:\ Wamp \bin\mysql\mysql5.6.12\的目录时,我找到了这个工作。当我手动删除这个文件时,我能够顺利地从phpMyAdmin删除数据库,没有任何问题。

#8


0  

I my case the problem was a residual dump file in the database directory. That file was probably generated during a backup script test I had been working on. Once I manually deleted the file I could then drop the database.

我的情况是,问题是数据库目录中的一个剩余转储文件。这个文件很可能是在我正在进行的备份脚本测试期间生成的。一旦我手动删除了文件,我就可以删除数据库。

#9


0  

I had the same issue (mysql 5.6 on mac) with 'can't rmdir..'-errors when dropping databases. Leaving an empty database directory not possible to get rid of. Thanks @Framework and @Beel for the solutions.

我有同样的问题(mac上的mysql 5.6),不能使用rmdir。删除数据库时的错误。留下一个空的数据库目录,不可能删除。感谢@Framework和@Beel解决方案。

I first deleted the db directory from the Terminal in (/Applications/XAMPP/xamppfiles/var/mysql).

我首先从终端(/应用程序/XAMPP/xamppfiles/var/mysql)删除了db目录。

For further db drops, I also deleted the empty test file. In my case the file was called NOTEMPTY but still containing 0:

对于进一步的db下降,我也删除了空的测试文件。在我的案例中,这个文件被称为NOTEMPTY,但仍然包含0:

sudo ls -al test
total 0
drwxrwx---   3 _mysql  _mysql  102 Mar 26 16:50 .
drwxrwxr-x  18 _mysql  _mysql  612 Apr  7 13:34 ..
-rw-rw----   1 _mysql  _mysql    0 Jun 26  2013 NOTEMPTY

Chmod first and then

修改文件权限,然后

sudo rm -rf test/NOTEMPTY

No problems dropping databases after that

在此之后,删除数据库没有问题。

#10


0  

just go to data directory in my case path is "wamp\bin\mysql\mysql5.6.17\data" here you will see all databases folder just delete this your database folder the db will automatically drooped :)

在我的案例路径中去到数据目录是"wamp\bin\mysql\mysql5.6.17\data"这里你会看到所有数据库文件夹都删除了这个数据库文件夹,db会自动下降:)

#11


0  

You can delete the data in the sql directory.

您可以删除sql目录中的数据。

For me i was using AMPPS on windows 10. I went to the AMPPs installtion directory. for me it was :

对我来说,我在windows 10上使用AMPPS。我去了AMPPs安装目录。对我来说,它是:

D:\Program Files (x86)\Ampps\mysql\data

because i have it installed on my secondary drive.

因为我把它安装在我的辅助硬盘上了。

Then refresh your SQL client and you will see it's gone.

然后刷新您的SQL客户机,您将看到它已经消失。

#12


0  

You may need to check two things.

您可能需要检查两件事情。

1- Database Foleder's permission The database you wants to delete must have the same owner as mysql process has.

1-数据库Foleder的权限,你想要删除的数据库必须拥有与mysql进程相同的所有者。

2- Directory Must be empty Goto the mysql data directory and verify that directory is empty

2-目录必须是空的Goto mysql数据目录,并验证该目录是空的。

After that connect your mysql cli and run drop database command again.

之后连接mysql cli并再次运行drop database命令。

#13


0  

Just to add to the responses so far: In Windows 10, the data files are kept here...

只是为了添加到目前为止的响应:在Windows 10中,数据文件保存在这里……

C:\ProgramData\MySQL\MySQL Server [m.n]\data

C:\ ProgramData MySQL \ MySQL服务器(梅西百货(m.n:行情)\ \数据

There will be directories for each schema in your database. You will want to go inside the schema you are trying to drop, manually delete any superfluous files then try the drop command again.

您的数据库中将有每个模式的目录。您将希望进入正在尝试删除的模式中,手动删除任何多余的文件,然后再次尝试删除命令。

Any workbench changes against a database will get stored in this location. For example, I had this error following a reverse engineering exercise on one of my databases and saving the changes which get stored in a .mwb file in this location.

任何针对数据库的工作台更改都会被存储在这个位置。例如,我在我的一个数据库上进行逆向工程练习,并保存了在这个位置的.mwb文件中存储的更改。