Forum: Ruby on Rails Lost connection to MySQL server during query

Posted by Al (Guest)
on 2006-03-13 11:12
I just downloaded and installed Ruby on Rails to a Win XP SP1 OS using 
XAMPP.
I started going through the beginner tutorials at rubyonrails.org. It 
appears as though Ruby on Rails is operating properly until I try to 
access the MySQL database I created for it. Then the browser displays a 
detailed statement created by Ruby. It is titled:

ActiveRecord::StatementInvalid in Recipe#New

Recipe is the table I created in the new database. The error message 
displayed next states:

Mysql::Error: Lost Connection to MySQL server during query: SHOW FIELDS 
FROM recipes

I checked the MySQL error log I get:

[Warning] mysql.user table is not updated to new password format; 
Disabling new password usage until mysql_fix_prifilege_tables is run

I ran the script and recieved a lot of error messages from mysql, 
stopped and restarted mysql, still no improvements and the same error 
messages are generated.

I also tried a variety of changes to config/database.yml file.

If anyone has any possible solutions or help on this problem it would be 
appreciated very much. Thank you
Posted by Mats Lindblad (Guest)
on 2006-03-13 11:18
(Received via mailing list)
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
Posted by Jonathan Viney (Guest)
on 2006-03-13 23:11
(Received via mailing list)
I had a similar problem and this was helpful:

http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32/
http://jeroen.concept-q.biz/files/

-Jonathan.
Posted by Al (Guest)
on 2006-03-20 15:43
Jonathan Viney wrote:
> I had a similar problem and this was helpful:
> 
> http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32/
> http://jeroen.concept-q.biz/files/
> 
> -Jonathan.


Jonathan, thank you - it worked!!

I did not use the msvrc70.dll file, I only used the mysql.so for MySQL 
version 5.0.15 and copied it to the correct directory.

Al
Posted by PerlDev (Guest)
on 2006-04-09 03:19
I had the same issue on CentOS 4.3;

ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL
server during query: SHOW FIELDS FROM users):
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
`log'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in
`execute'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:278:in
`columns'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:734:in
`columns'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1663:in
`attributes_from_column_definition'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1185:in
`initialize_without_callbacks'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/callbacks.rb:236:in
`initialize'
    /lib/account_system.rb:93:in `ident'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:354:in
`call_filters'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:350:in
`call_filters'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:339:in
`before_action'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:331:in
`perform_action_without_benchmark'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in
`perform_action'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in
`process_without_session_management_support'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in
`process'
    /app/controllers/application.rb:14:in `process'
    /app/controllers/application.rb:13:in `process'
    /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
`dispatch'
    /var/www/rails_app/public/dispatch.cgi:10


Rendering
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/templates/rescues/layout.rhtml
(500 Internal Error)
Posted by Anonymous (Guest)
on 2006-04-26 06:32
(Received via mailing list)
I encountered this error as well, when using WinXP with InstantRails and 
WEBrick. I found that when I changed the password for my database user 
to blank / empty string, everything started working fine. This is OK on 
a test machine, but is obviously not an option for production boxes. ;-)
Posted by Ron Chaplin (Guest)
on 2006-11-05 01:28
Anonymous wrote:
> I encountered this error as well, when using WinXP with InstantRails and 
> WEBrick. I found that when I changed the password for my database user 
> to blank / empty string, everything started working fine. This is OK on 
> a test machine, but is obviously not an option for production boxes. ;-)

I had the same issue. Also solved by adding in a blank password. 
However, isn't this considered a bug if we need to adapt our DB to "fix" 
the rails system? I'm new to the ruby on rails community so please be 
gentle.
Posted by Ron Chaplin (Guest)
on 2006-11-05 01:42
Ron Chaplin wrote:
> Anonymous wrote:
>> I encountered this error as well, when using WinXP with InstantRails and 
>> WEBrick. I found that when I changed the password for my database user 
>> to blank / empty string, everything started working fine. This is OK on 
>> a test machine, but is obviously not an option for production boxes. ;-)
> 
> I had the same issue. Also solved by adding in a blank password. 
> However, isn't this considered a bug if we need to adapt our DB to "fix" 
> the rails system? I'm new to the ruby on rails community so please be 
> gentle.

Ok, so this is the solution I just found for my previous post. I did a 
quick followup search and came across this,

http://www.ruby-forum.com/topic/51141#22397

By issuing the command
[code]
sudu mysqladmin -p old-password ENTER_PASSWORD_HERE
[/code]

I was able to use the old hash style password and still have rails work. 
It's a workaround for something I still consider a bug.

HTH

Ron Chaplin
http://www.t73-softdesign.com

DEV:
Ubuntu 6.10
Apache 2.0
PHP 5.0
MySQL - 5.0.22
Posted by Ken (Guest)
on 2006-12-07 23:34
You are probably using an older version of MySQL which has different 
password mechanism. You can fix the problem by simply updating to the 
latest version of MySQL. I used to have the problem too, but after I 
updated MySQL, it all works fine.
Posted by Michel R Vaillancourt (Guest)
on 2006-12-11 14:37
(Received via mailing list)
Ken wrote:
> You are probably using an older version of MySQL which has different 
> password mechanism. You can fix the problem by simply updating to the 
> latest version of MySQL. I used to have the problem too, but after I 
> updated MySQL, it all works fine.
> 

	Thanks for the suggestion.  I checked that, and its not it.

	I loaded RadRails, and the data-browser worked fine.  However, the 
WEBrick apps yet again would not even try to connect to the DB server; 
not failed password issues or whatever.  Those I would see in the MySQL 
server log.  No connection attempt at all.  I am so far rather 
disappointed with my Ruby on Rail experience...  not being able to even 
follow along in the tutorial is rather disheartening.

	I wiped my Ruby and Rails environments twice and reinstalled to make 
sure I hadn't done something daft, but that didn't help.  This morning I 
wiped Ruby & Rails again, and installed "Instant Rails" to see if I can 
get any further down that road.  If not, I suppose the next thing to do 
is just set up a testing environment on my production Apache box to see 
if a deployed application works there at all.

	As a I say, rather disheartening.

--
	--Michel Vaillancourt
	Wolfstar Systems
	www.wolfstar.ca
Posted by Taylor Strait (taylorstrait)
on 2006-12-11 16:44
Are you running the latest version of rails, the 1.2RC1?  There is a 
known issue with the WebBrick server that causes it to lose connection:

http://dev.rubyonrails.org/ticket/6687

I would either downgrade to 1.1 or wait for 1.2 final.  However, since 
you cannot connect at all it sounds like a different problem.  You 
should start going through the RubyonRails.org Wiki.  There is a page on 
this.


Posted by Curt Hibbs (Guest)
on 2006-12-11 21:39
(Received via mailing list)
On 12/11/06, Michel R Vaillancourt <michel@wolfstar.ca> wrote:
>
> get any further down that road.  If not, I suppose the next thing to do is
> just set up a testing environment on my production Apache box to see if a
> deployed application works there at all.
>
>        As a I say, rather disheartening.


I know that "lost connection" problem can also be caused by an older, 
buggy
version of the mysql ruby adapter. I would recommend trying Instant 
Rails
(as you said above). It includes an up to date mysql driver and should 
not
have that problem.

Curt
Posted by Matt C (Guest)
on 2007-01-03 21:32
I am getting this error as I try and do a very-basic Rails tutorial. 
Between this thread and

http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32/

it looks like I have about 15 different things I should try, half of 
which involve installing some bundled rails, apache, and mySQL  combo.

Am I a dick if I don't want to start trying all these? I have Apache, 
rails, and MySQL on this machine (XP  box). They work fine. I want rails 
to work now.

Sorry, just kinda frustrated...
Posted by Matt C (Guest)
on 2007-01-03 21:46
Okay, I'm in a better mood now. Fixed with this:

http://www.vandomburg.net/pages/mysql-ruby-windows

This one didn't help:
http://rubyforge.org/projects/mysql-win

I think I'm going to have to build a few things before agreeing that RoR 
is such a big timesaver... prolly see you around.

Matt
Posted by Jodi Showers (jshow)
on 2007-01-03 22:00
(Received via mailing list)
installations (imo) are the biggest problem with rails and it's
supporting cast (mysql drivers. os specific issues, server configs, etc)

after installation is solid, likely your biggest problem will be one
of documentation. Building your personal blogroll and improving your
ability intuit Rail's philosophy with increase your ability to
deliver quality quickly.

As a final note, you should not consider that to power of rails can
replace solid best practices. (not saying you were, just wanted to
complete the general thought)

Good luck on your journey Matt - you'll find the community a good
partner.
Jodi

General Partner
The nNovation Group inc.
www.nnovation.ca/blog
Posted by Jodi Showers (jshow)
on 2007-01-03 22:06
(Received via mailing list)
On 3-Jan-07, at 3:59 PM, Jodi Showers wrote:

> As a final note, you should not consider that to power of rails  
>
>> I think I'm going to have to build a few things before agreeing   
>> that RoR is such a big timesaver... prolly see you around.
>>
>> Matt
>>
>> -- 
>> Posted via http://www.ruby-forum.com/.
>>
>> >
>

correction on that (and a bottom quote. go figure!) - it's the
supporting cast that's the problem with installs - not with rails
specifically.

Jodi
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.