Error in dropping a database in MySQL (can't rmdir '.\oro', errno: 41)
Asked Answered
G

8

30

I can't delete a database from mysql. The error is like

ERROR 1010 (HY000): Error dropping database (can't rmdir '.\oro', errno: 41)

I tried to drop the database 'oro' using phpmyadmin and it also showing the same error message and alerts

"DROP DATABASE" statements are disabled.

Gabbert answered 30/7, 2013 at 12:38 Comment(5)
please refer this.https://mcmap.net/q/160354/-how-to-drop-databaseHalima
Do you have access to the actual database folder?Underslung
Thanks @KayNelson I tried accessing the database folder C:\wamp\bin\mysql\mysql5.5.24\data and deleted the database folder "oro". But is that the proper way?Gabbert
No the proper way is to use the statement drop of course. But, If you can shut down the mysql service, then move the folder to another place, then start the mysql service again. If it goes online again you can check the error log file if it indicates that its missing the database. If it does not work just move it back and start the service again.Underslung
Did you look at this issue? #4411130Underslung
E
85

In my case, I solved the problem by navigating to the folder:

C:\wamp\bin\mysql\mysql5.6.12\data

and remove the database folder which I was trying to drop. That's it.

Erikaerikson answered 10/11, 2013 at 9:46 Comment(2)
Deleting the db folder inside the data folder is the right solution. Restore from backup file and you're back in business.Glaucoma
what if it is linux ?Twelvemo
I
3

same error was happening with me in XAMPP somehow i got a solution just go to c:/xampp/mysql/data

delete the database folder which you want to delete from PhpMyAdmin then go to browser and just refresh localhost/phpMyAdmin and database will be deleted which you were wishing

Imprisonment answered 3/9, 2022 at 10:52 Comment(0)
B
1

The ERROR 1010 you got is occurred When you create a database, a file is created for you. This implies "create database foo" will create a directory foo in your data directory. All table definitions/data for foo are in the foo directory. All these tables are created in the server and their corresponding files are created by the server. If, for some reason, a file is created in or placed in this directory that is not generated by MySQL, the error 1010 will be issued by the server when you drop foo.

and in case when you are trying to drop database using phpmyadmin refer this phpmyadmin enable drop database statement.

Hope this may help you to understand the error.

Boogiewoogie answered 30/7, 2013 at 13:18 Comment(1)
Thanks @Himanil You mentioned unwanted files which are not generated by MySQL could be found in the database directory. Which are those unwanted files? Is .empty file such kind?Gabbert
A
1

Mysql generate two file for any table

  1. .frm
  2. .ibd

check in your directory for both file must exist, if any one is missing then remove the remaining one or if you wish you can remove all the file, but be careful this my delete all your data from tables.

This works for me, I hope it also works for you too.

Antitragus answered 6/3, 2015 at 11:1 Comment(0)
L
1
  1. Go to

    C:\wampXY\bin\mysql\mysqlx.y.z\data

(XY.. refer versions)

  1. Rename the file you want to delete to anything else.(optional only for special cases)

  2. Now simply delete the renamed file.

Leapfrog answered 31/5, 2019 at 12:16 Comment(0)
U
0

try changing the value in config file of phpmyadmin,

$cfg['AllowUserDropDatabase']   = TRUE;
Underslung answered 30/7, 2013 at 13:27 Comment(0)
L
0

I realize I'm really late to the party, but when I had this issue (and ended up here) I navigated to the directory and actually found a file had inadvertently been created in the directory via INTO OUTFILE without a path, and I'd forgotten about it. MySQL seemed to have an issue because it had not created the file, and so could not delete the directory in question.

Lucinalucinda answered 8/12, 2016 at 15:7 Comment(0)
P
0

If you're using XAMPP just go to C:/xampp/mysql/data/YourDBFolder

After deleting that folder everything should be okay.

Peculium answered 28/1, 2018 at 18:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.