I''m trying to set up RoR on a laptop and having all sorts of troubles. I''m running XP SP2, I did a quick install of appache/mysql using Xampp, which worked fine. I grabbed the latest windows install of ruby and rails, installed it ok and got it running. The moment I try to run a rails page that queries a database, it fails every time, and I get the following error: Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS FROM users RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:278:in `columns'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:734:in `columns'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1663:in `attributes_from_column_definition'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1185:in `initialize_without_callbacks'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/callbacks.rb:236:in `initialize'' #{RAILS_ROOT}/app/controllers/account_controller.rb:20:in `new'' #{RAILS_ROOT}/app/controllers/account_controller.rb:20:in `signup'' I tried to update the mysql gem by typing gem install mysql, and when I do, I get the following errors as well: C:\>gem install mysql C:\>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install mysql Attempting local installation of ''mysql'' Local gem file not found: mysql*.gem Attempting remote installation of ''mysql'' Building native extensions. This could take a while... ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. ruby extconf.rb install mysql\nchecking for mysql_query() in mysqlclient.lib.. . no checking for main() in m.lib... yes checking for mysql_query() in mysqlclient.lib... no checking for main() in z.lib... no checking for mysql_query() in mysqlclient.lib... no checking for main() in socket.lib... no checking for mysql_query() in mysqlclient.lib... no checking for main() in nsl.lib... no checking for mysql_query() in mysqlclient.lib... no Results logged to c:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out So what the hell am I doing wrong??? Never had the slightest problem in the past getting RoR working. This is my application environment: Ruby version 1.8.2 (i386-mswin32) RubyGems version 0.8.10 Rails version 1.0.0 Active Record version 1.13.2 Action Pack version 1.11.2 Action Web Service version 1.0.0 Action Mailer version 1.1.5 Active Support version 1.2.5 Application root C:/rails/test Environment development Database adapter mysql thanks for any clues, sure its something simple (I hope) -- Posted via http://www.ruby-forum.com/.
Hi,> The moment I try to run a rails page that queries a database, it fails > every time, and I get the following error: > > Mysql::Error: Lost connection to MySQL server during query: SHOW > FIELDS FROM usersHopefully this isn''t a misguided suggestion, but I was getting similar error messages when I was trying to connect to a MySQL 4.1 server that had old-passwords enabled. The workaround, if you can''t disable old-passwords, is to set a blank password for the database user you''re working with (then the encryption cipher is irrelevant). HTH, - Andrew
thanks Andrew that seemed to fix it! Cheers. -- Posted via http://www.ruby-forum.com/.
I wrestled with this problem for a good while. couple things I noticed: 1 - old versus new passwords might be an issue. first thing''s first, add a user with the old password format, and a user with the new password format. test with each of those users. one might work. if so then you''re golden. stick with that version of the password hash (old, new, whatever). This wasn''t what fixed my problems though 2 - connecting to a db server that was NOT localhost worked ok for me. Why? Hell if I know. 3 - on a lark I checked that I had mysql.so in : C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt and oddly enough. I didn''t. The thought occurred to me to check from some website I ran into ... but of course I can''t find right now. If a google search doesn''t turn up anything that works one of us would have no issue sending you one. So, yeah, that fixed it for me. Why? I have no idea but it works! - Joel On 1/5/06, Andrew Foster <andrew@solutionsfirst.com.au> wrote:> Hi, > > > The moment I try to run a rails page that queries a database, it fails > > every time, and I get the following error: > > > > Mysql::Error: Lost connection to MySQL server during query: SHOW > > FIELDS FROM users > > Hopefully this isn''t a misguided suggestion, but I was getting similar > error messages when I was trying to connect to a MySQL 4.1 server that > had old-passwords enabled. > > The workaround, if you can''t disable old-passwords, is to set a blank > password for the database user you''re working with (then the encryption > cipher is irrelevant). > > HTH, > > - Andrew > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Joel - I''m missing that mysql.so file you mentioned as well. If anyone wants to send me one to robbie dot shepherd at gmail.com I''d appreciate it! thanks for the replies. -- Posted via http://www.ruby-forum.com/.
robbie shepherd wrote:> Joel - I''m missing that mysql.so file you mentioned as well. If anyone > wants to send me one to robbie dot shepherd at gmail.com I''d appreciate > it! > > thanks for the replies.Go here guys http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32. Has the mysql.so files you''re looking for (both mysql 4 & 5). Make sure to put mysql.so in the C:\ruby\lib\ruby\1.8\i386-mswin32 directory. Have fun. -- Posted via http://www.ruby-forum.com/.