Thoughts and tutorials on programming

Saturday, November 22, 2008

rails error report

C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb:47:in `exec': No such file or directory - mysql.exe
(Errno::ENOENT)
from C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb:47
from c:/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/dbconsole:3

meant "you need to go into dbconsole and force it to 'exec' the full path name of mysql.exe, not just 'mysql.exe'"

also if it says
Couldn't find database client: mysql. Check your $PATH and try again.
but mysql IS in your path, no fear, edit dbconsole.rb and add mingw wherever it does =~ /win32/

10 comments:

Anonymous said...

To anyone who might be able to help....

I am experiencing this same error that is interpreted as needing to go into dbconsole.rb and force it to "exec" the full path name of mysql.exe...

How do I do that and where do I find dbconsole.rb?

Roger Pack said...

for me it was in C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb

copying mysql.exe to your current directory might help, too [and *.dll]

Anonymous said...

Roger,

Thanks for the suggestion but...

I copied mysql.exe and libmsql.dll first into C:\Ruby\bin, then into C:\WebApps\Photos, my application folder.

Neither change made a difference. Any other ideas?

ITGuy50 @Yahoo.com

Roger Pack said...

hmm. Make sure it's mysql 5.0, also does running mysql on the command line work?
what does it output exactly?

Anonymous said...

mysql works fine from the command line.

The response to "ruby script/dbconsole" at the command line is:

C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/commands/dbconsole.rb:61 in "exec': No such file or directory - mysql.exe (Errno::EN0ENT)

ITGuy50 @Yahoo.com

Roger Pack said...

appears that it means "ruby has a bug where running exec("mysql.exe", "args") doesn't work if mysql is in a path with spaces"

hack-around:

in c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/commands/dbconsole.rb
# for me

replace
#exec(find_cmd('mysql', 'mysql5'), *args)

with

exec("C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysql.exe", *args)

GL!
-r

Unknown said...

Roger,

Thanks so much. I will try your suggestion this evening. Seems so simple when someone shows you what is needed.

I wondered about "spaces" having seen those kind of issues in the past, but did not want to reinstall MySQL into a folder without space names unless necessary.

I like your suggestion. Thanks again!

Unknown said...

Roger,

Yor advice worked perfectly. problem solved! Thanks.

Anonymous said...

I think there is more safe way to solve the problem. In %mysql_path%\bin you should add batch file 'mysql' without extension 'bat'(or 'cmd') in which following content placed: @%mysql_path%\bin\mysql.exe %*

escorts barcelona said...

This can't have effect in reality, that's what I think.

Contributors

Followers