22

I have a database that I would like to drop from the server but when I wanna drop it I am getting the above error.

Trying to look for the solution I found some answer the problem at this link Error in dropping a database in MySQL (can't rmdir '.\oro', errno: 41) but what I don't see the folder they are talking about. I went in the C:\Program Files\MySQL\MySQL Server 5.5\data folder but I coudn't see a folder with the name of my database not even when I did searching in the folder C:\Program Files\MySQL\MySQL Server 5.5\

Community
  • 1
  • 1
aidonsnous
  • 1,475
  • 4
  • 19
  • 41

4 Answers4

38

Windows Error 41 is "directory not empty." https://msdn.microsoft.com/en-us/library/t3ayayh1.aspx

Proceed cautiously. You don't want MySQL's internal structures to become inconsistent with what's on the disk.

Run the query SELECT @@DATADIR; to find the directory that should contain a folder for each of your databases, including one called abm.

Contrary to the advice offered in the other question, don't delete the abm folder once you find it. Instead, leave the folder there, and move the files inside it somewhere outside the datadir where MySQL can't see them.

Then try again to drop the database the normal way.

Finally, restart MySQL to be absolutely sure that its internal structures are consistent with the disk files, by reviewing the log for errors. If the server restarts with no errors, and the database is no longer listed, it should be safe to delete the stray files you copied out of harm's way, above.

Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427
18

If you are windows user. Go to your XAMPP directory -> Mysql directory -> data -> then you will be seeing your list of databases inside this folders. Just cut and paste the database outside somewhere in desktop which you want to remove. If you are using phpmyadmin refresh the page. If you are not finding any errors. you are good to go.

Vivek Keviv
  • 496
  • 4
  • 19
3

I was getting same error, and did two things

  1. I just provided full access rights to current user.
  2. Open Database folder and than execute your sql (drop database mydatabase).

If above solution not works for you, than you have to delete database folder manually.

Ravi
  • 1,744
  • 2
  • 20
  • 37
0

Go to xampp/mysql/data/database_name there you will see with multiple file with your tables in the idb format. Delete all the table.idb file you want to remove. If you need to generate the tables again run php artisan migrate:refresh.

Lim Han Yang
  • 350
  • 6
  • 23