可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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;"
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)
The command put to use was DROP DATABASE test;
I am using MYSQL and PHPMYADMIN. Any help on how to drop the file with no errors?
回答1:
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.
MySQL displays an error message when it cannot remove the directory
you can really drop the database manually by removing any remaining files in the database directory and then the directory itself.
回答2:
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":
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.
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.
回答3:
Go to the datadir for your mysql installation and rm the databases manually. It can be
/usr/local/var/mysql
Then,
rm -R <Your DB name>
To check datadir for your installation,
vim the mysql.server file and find it there.
回答4:
For phpmyadmin, go to xampp\mysql\data and simply delete the database folder. Worked for me !!
回答5:
If it is XAMPP, Do the following:
cd /opt/lampp/var/mysql;
sudo su;
rm -rf test;
Hope this helps.
回答6:
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.
Then I refreshed the page at phpMyAdmin, and the database was gone.
回答7:
Just to add to the responses so far: In Windows 10, the data files are kept here...
C:\ProgramData\MySQL\MySQL Server [m.n]\data
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.
回答8:
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.
回答9:
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.
回答10:
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.
I first deleted the db directory from the Terminal in (/Applications/XAMPP/xamppfiles/var/mysql).
For further db drops, I also deleted the empty test file. In my case the file was called NOTEMPTY but still containing 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
回答11:
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 :)
回答12:
You can delete the data in the sql directory.
For me i was using AMPPS on windows 10.
I went to the AMPPs installtion directory.
for me it was :
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.
回答13:
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.
2- Directory Must be empty Goto the mysql data directory and verify that directory is empty
After that connect your mysql cli and run drop database command again.