tags:

views:

1393

answers:

4

This has been asked before but not exactly in the same way (other users had Rails/servers issues, and I'm not having the issue with OLD_PASSWORDS)

I'm trying to make my Ruby app work with MySQL using Ruby-MySQL,

The setup is supposed to be quite simple:

% ruby ./setup.rb
% ruby ./test.rb hostname user passwd
# ruby ./install.rb

However, when I'm trying to run test.rb using localhost and root, I get the following error:

connect............./Users/turbovince/Desktop/ruby-mysql-0.2.6/mysql.rb:1019:in `read': Packets out of order: 0<> (RuntimeError)

However, I am capable of connecting to the MySQL server using /usr/local/mysql/bin/mysql without any problem.

I'm running MySQL 5.1.32 and Ruby 1.9

Any hint would be appreciated.

EDIT: I also tried with 127.0.0.1 instead of localhost.

A: 

Have you tried using 127.0.0.1 instead of localhost?

Matt
Yep, same problem though.
turbovince
+2  A: 

It could be that maybe this isn't compatible with 1.9 yet, a lot of Ruby gems and librarys are not yet compatible with the changes in Ruby 1.9

EDIT: As pointed out, it is now working, I didn answer this in March though so the answer was accurate then. The best bet for this kind of thing is that you go and check isitruby19

railsninja
+1  A: 

The mysql gem for ruby 1.9 is out there and working properly. You can install the gem using

gem install mysql

and check whether this solves your problem or not. But ReadMe docs of this gem declares that the MySQL version that is compatible with this version of gem is 5.0.83. So, it might take some time to get the 5.1.x versions to work properly with ruby 1.9.1.

+2  A: 

I've copied libmysql.dll from this address: http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/ to ruby/bin and it works with mysql version: 5.1.30.

I am using ruby 1.8.6 on windows machine and had previously installed mysql gem with: gem install mysql. Before copying this dll I also had problems with mysql 5.1.30 version so I guess that this could potentially resolve issue you have with ruby 1.9.1.

Hope that this helps.

draganstankovic
This is now the "correct" answer as far as i can tell.
JasonTrue