29

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dan
  • 425
  • 1
  • 5
  • 13
  • please refer this.http://stackoverflow.com/questions/2046681/how-to-drop-database – Amernath Jul 30 '13 at 12:46
  • 1
    Do you have access to the actual database folder? – Mad Dog Tannen Jul 30 '13 at 12:46
  • 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? – Dan Jul 30 '13 at 12:54
  • 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. – Mad Dog Tannen Jul 30 '13 at 13:24
  • Did you look at this issue? http://stackoverflow.com/questions/4410630/phpmyadmin-enable-drop-database-statement – Mad Dog Tannen Jul 30 '13 at 13:26

8 Answers8

84

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.

Jamshid Hashimi
  • 7,639
  • 2
  • 28
  • 27
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

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.

Community
  • 1
  • 1
Himanil Gupta
  • 91
  • 1
  • 12
  • 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? – Dan Jul 30 '13 at 13:57
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.

Alpesh Jikadra
  • 1,692
  • 3
  • 18
  • 38
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.

0

try changing the value in config file of phpmyadmin,

$cfg['AllowUserDropDatabase']   = TRUE;
Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
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.

0

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

After deleting that folder everything should be okay.

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66