Lost connection to MySQL server during query


#1

hello,

I just upgraded to latest version of Rails in an attempt to get rid of
the SessionRestore issue discussed here:
http://wiki.rubyonrails.com/rails/pages/HowtoAvoidSessionRestoreError.
At the bottom of the page, it says this problem has been fixed in the
newest version of rails. However, after installing, I am now getting
the error mentioned in the subject although the actual SQL statement it
is complaining about works fine from other mysql clients. Does anyone
have a clue about what is going on?

Thanks in advance,
Jonathan


#2

Jonathan Leonard wrote:

I just upgraded to latest version of Rails in an attempt to get rid of
the SessionRestore issue discussed here:
http://wiki.rubyonrails.com/rails/pages/HowtoAvoidSessionRestoreError.
At the bottom of the page, it says this problem has been fixed in the
newest version of rails. However, after installing, I am now getting
the error mentioned in the subject although the actual SQL statement it
is complaining about works fine from other mysql clients. Does anyone
have a clue about what is going on?

I’ve spent much of today finding a fix for this. See:
http://wiki.rubyonrails.com/rails/pages/Mysql+Connection+Problems/

Installing the mysql gem fixed it for me. (If the install fails,
see http://www.ocsforums.com/showthread.php?t=132 )


We develop, watch us RoR, in numbers too big to ignore.


#3

mrj wrote:

I’ve spent much of today finding a fix for this. See:
http://wiki.rubyonrails.com/rails/pages/Mysql+Connection+Problems/

Installing the mysql gem fixed it for me. (If the install fails,
see http://www.ocsforums.com/showthread.php?t=132 )


We develop, watch us RoR, in numbers too big to ignore.

I’m working on Windows at the moment. So, I’m pretty sure it isn’t the
Fedora gcc compiler. :slight_smile: Here’s the result of trying to install the
mysql gem:

C:\Documents and Settings\Jonathan>“c:\ruby\bin\ruby.exe”
“c:\ruby\bin\gem” inst
all mysql
Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Updating Gem source index for: http://gems.rubyforge.org
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

Is it because I didn’t point it to ‘mysql_config’? If so, where is this
file on Windows and how do I point it to it.

Thanks.


#4

Under Windows installing native msql binding from gem does not work.
Looking to your log seems that Makefile did not generated. You should
fix
extconf.rb first (and also do not forget to install MSVC, better .Net
2003).

But easier for you would be download compiled *.so file. You could find
it
here http://pomozov.info/opensource.php#mysql_ruby (ver 2.7, by VS.Net)


#5

anatol.pomozov wrote:

Under Windows installing native msql binding from gem does not work.
Looking to your log seems that Makefile did not generated. You should
fix
extconf.rb first (and also do not forget to install MSVC, better .Net
2003).

But easier for you would be download compiled *.so file. You could find
it
here http://pomozov.info/opensource.php#mysql_ruby (ver 2.7, by VS.Net)

Thanks for the answer. That fixed this problem. However, there is
still a problem with logging in. I hit the ‘login’ button and nothing
ever happens.

Here is an excerpt from the log file:

Processing SecurityController#login (for 127.0.0.1 at 2005-11-28
15:55:44) [POST]
Parameters: {“user_login”=>“blaird”, “action”=>“login”,
“controller”=>“security”, “user_password”=>“test123”, “login”=>“Login
\302\273”}
e[4;36;1mUser Load (0.000000)e[0m e[0;1mSELECT * FROM users WHERE
(login = ‘blaird’ AND password =
‘5544dcd960516e6465fbd5b28bccbc2d5a3498e3’ AND active = ‘Yes’) LIMIT
1e[0m
Redirected to http://127.0.0.1:3000/main
e[4;35;1mUser Columns (0.031000)e[0m e[0mSHOW FIELDS FROM userse[0m
Completed in 0.04700 (21 reqs/sec) | DB: 0.03100 (65%) | 302 Found
[http://127.0.0.1/security/login]

It looks as if the login succeeds and a redirect to /main is attempted,
but that never manifests in the browser.

Any ideas?

(One other thing, the server seems generally more unstable now. Even
after closing the webrick server and restarting it and closing and
restarting the browser, the home page is not being shown (which was
working even though the login failed)).


#6

Thanks for the answer. That fixed this problem. However, there is
still a problem with logging in. I hit the ‘login’ button and nothing
ever happens.

Here is an excerpt from the log file:

Processing SecurityController#login (for 127.0.0.1 at 2005-11-28
15:55:44) [POST]
Parameters: {“user_login”=>“blaird”, “action”=>“login”,
“controller”=>“security”, “user_password”=>“test123”, “login”=>“Login
\302\273”}
e[4;36;1mUser Load (0.000000)e[0m e[0;1mSELECT * FROM users WHERE
(login = ‘blaird’ AND password =
‘5544dcd960516e6465fbd5b28bccbc2d5a3498e3’ AND active = ‘Yes’) LIMIT
1e[0m
Redirected to http://127.0.0.1:3000/main
e[4;35;1mUser Columns (0.031000)e[0m e[0mSHOW FIELDS FROM userse[0m
Completed in 0.04700 (21 reqs/sec) | DB: 0.03100 (65%) | 302 Found
[http://127.0.0.1/security/login]

It looks as if the login succeeds and a redirect to /main is attempted,
but that never manifests in the browser.

Any ideas?

(One other thing, the server seems generally more unstable now. Even
after closing the webrick server and restarting it and closing and
restarting the browser, the home page is not being shown (which was
working even though the login failed)).

Anyone else having similar problems after upgrading rails? Is there a
way to revert back to an old installation of rails? Gem always gets the
latest version, no?