'rake db:drop' does not work

I am using Rails v2.3.2 with MySQL v5.1 and mysql2 gem.

I run the following rake tasks in a method like:

def db_operation
    Rake::Task['db:drop'].invoke #this one does not work

but Rake::Task['db:drop'].invoke does not drop my database**, and there is no error message which makes me have no clue to find the reason.

Then: I go to MySQL command-line to execute "DROP DATABASE my_db;" , it raise me the following error message:

ERROR 1010 (HY000): Error dropping database (can't rmdir './my_db/', errno: 17)

After that: I run above code again, the database surprisingly get dropped...

What was happening?? Why my rake db:drop does not drop database, but after I run drop command on MySQL command-line and run rake db:drop again, it get dropped??? (and I got error when I run on MySQL command-line)


rake db:create and rake db:migrate are working without problem.


Refer this LINK

you might be having files in /var/lib/mysql/my_db/ that mysql didn't create. Try listing those files and see what's there. Try moving anything there to a temporary directory (or deleting if you're really sure you won't need them), then try again.

Need Your Help

Windows server 2008 R2 Service error 1053

windows service

I have problems with starting service.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.