Mysql lost connection

Hi,

I’m lost and my mysql connection as well… I got this
error in my production.log:

ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL
server during query: SET NAMES ‘utf8’):

Config:
Debian Sarge (last updated), Rails 1.1.2, Webrick,
mysqld Ver 4.1.11-Debian_4sarge2 for pc-linux-gnu on i386
apache2 with mod_rewrite and webrick as proxy on 8080.

Is there a chance to get this configuration working ? I have the same
environment on my dev machine and everything is OK on it…

When I connect on this MySQL server using mysqlclient and type the
same command : set names ‘utf8’, everything works !

This is my database.yml:
production:
adapter: mysql
database: test
username: ***
password: ***
socket: /var/run/mysqld/mysqld.sock
encoding: utf8

I have rebooted the server, MySQL, Webrick, Apache…

Really, I am lost…Any help is REALLY appreciated…

Cheers
Seb

username: ***
password: ***
socket: /var/run/mysqld/mysqld.sock
encoding: utf8

I have rebooted the server, MySQL, Webrick, Apache…

Really, I am lost…Any help is REALLY appreciated…

What’s the value of wait_timeout in mysql? Run this to see what it
is:

show variables like 'wait_timeout';

More info here…

http://dev.mysql.com/doc/refman/4.1/en/gone-away.html

-philip

On 4/27/06, Philip H. [email protected] wrote:

username: ***

    show variables like 'wait_timeout';

More info here…

http://dev.mysql.com/doc/refman/4.1/en/gone-away.html

Hi,

Here is the value: seems correct…

mysql> show variables like ‘wait_timeout’;
±--------------±------+
| Variable_name | Value |
±--------------±------+
| wait_timeout | 28800 |
±--------------±------+
1 row in set (0.00 sec)

Any Ideas ?
Seb

Config:
Debian Sarge (last updated), Rails 1.1.2, Webrick,
mysqld Ver 4.1.11-Debian_4sarge2 for pc-linux-gnu on i386
apache2 with mod_rewrite and webrick as proxy on 8080.

What ruby-mysql interface do you use?
In this case, this may be the most important.
There are two ruby-mysql interfaces:
(1)Ruby/MySQL
(2)MySQL/Ruby
and there are two Ruby/MySQL(version number is same…)

I wonder if you use different Ruby/MySQL libraries between
production machine and dev machine.

Ruby/MySQL library is used by rails in order to connect to MySQL.

I recommend the following basic checking and installation:

(1) check what kind of mysql library is used

Open
“gems/activerecord-1.14.1/lib/active_record/connection_adapters/mysql_adapter.rb”
and
insert some debug prints around (ex:puts ‘foo’)

require_library_or_gem ‘mysql’

By these debug output, you can check what kind of mysql library is used

  • Ruby/MySQL on gem(if you did “gem install mysql”)
  • gems/activerecord-1.14.1/lib/active_record/vendor/mysql.rb
    (attached with Rails)

Are using libraries same for two machines?

If different and your using library on production machine is the LATTER,
try to install by the following instruction.

(2) try to install Ruby/MySQL by yourself.

Download ruby-mysql-0.2.6.tar.gz from
http://www.tmtm.org/en/ruby/mysql/README_en.html
and install it.

By this installation, you can make mysql_adapter.rb to use
mysql.rb different from active_record/vendor/mysql.rb.

active_record/vendor/mysql.rb is patched for MySQL 4.1.11,
but the version number is same…
And I think this patch may not be suitable for MySQL 4.1.11 on
Debian-Sarge.


Yasuhiro Yoshida, Software Engineer, Japan
[email protected]

I am very lost with this problem ! Everything is chaotique !
I need this setyp runnning ASAP … Any help is
wanted… Please…

Cheer
Seb

On 4/27/06, Sebastien H. [email protected] wrote:

apache2 with mod_rewrite and webrick as proxy on 8080.
database: test
is:
Here is the value: seems correct…
Seb


Sebastien H.
Open Source & Web Consultant
EasyBox Technologies
Rue des Terreaux 7
CH-1003 Lausanne
Switzerland
Tel: + 41 21 312 58 66
Fax: + 41 21 312 58 65

Thanks a lot ! That was exactly that problem !
I’ve juste make a gem install mysql
and everything is now OK.

Thank you.
Cheers
Seb

On 4/28/06, Yoshida Y. [email protected] wrote:

(2)MySQL/Ruby
(1) check what kind of mysql library is used
(attached with Rails)
and install it.
Yasuhiro Yoshida, Software Engineer, Japan

mysqld Ver 4.1.11-Debian_4sarge2 for pc-linux-gnu on i386
adapter: mysql
is:

Fax: + 41 21 312 58 65
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Sebastien H.
Open Source & Web Consultant
EasyBox Technologies
Rue des Terreaux 7
CH-1003 Lausanne
Switzerland
Tel: + 41 21 312 58 66
Fax: + 41 21 312 58 65