Forum: Ruby on Rails Troubleshooting "Lost connection to MySQL server.."

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2006-06-06 11:28
(Received via mailing list)
Hello all,

Though I've read all I could about the "Lost connection to MySQL
server during query: SHOW FIELDS FROM ...", I'm still unable to use RoR.

I'm on Linux Mandriva 2006 / MySQL-4.1.12 / ruby-1.8.2

- The userid/password have access to the database and the table (it's
the root user on MySQL)
- I'm on a nonstandard socket/port, but I've set the socket in
config/databases.yml
- The table exists, the name is all lowercase and plural ("recipes")
- The table has a primary key called 'id' (int, autoincrement)
- I don't have the "old passwords" in my MySQL setup

- The Application Trace, Framework Trace, Full Trace, session dump
don't show anything useful
- The MySQL log shows nothing either. Nor syslog.

How on earth can I find out exactly what is going on ?
Is there some place where RoR dumps exactly what it is trying to do
and what error status it receives ?

Thanks for any help
-- Jean Marc
Alan F. (Guest)
on 2006-06-06 16:37
removed_email_address@domain.invalid wrote:
> Hello all,
>
> Though I've read all I could about the "Lost connection to MySQL
> server during query: SHOW FIELDS FROM ...", I'm still unable to use RoR.

I seem to remember I got this until I installed the mysql gem.

A.
Alan F. (Guest)
on 2006-06-06 16:38
Alan F. wrote:
> removed_email_address@domain.invalid wrote:
>> Hello all,
>>
>> Though I've read all I could about the "Lost connection to MySQL
>> server during query: SHOW FIELDS FROM ...", I'm still unable to use RoR.
>
> I seem to remember I got this until I installed the mysql gem.
>
> A.


http://wiki.rubyonrails.org/rails/pages/Mysql+Conn...

Ignore all the apt-get stuff and scroll until you see the gem :-)

A.
(Guest)
on 2006-06-06 17:58
(Received via mailing list)
>>> Though I've read all I could about the "Lost connection to MySQL
>>> server during query: SHOW FIELDS FROM ...", I'm still unable to use RoR.

Thanks to all (thanks Alan) :

- On Mandriva 2006 with MySQL : install the following packages :

ruby
apache-mod_ruby
ruby-RubyGems
ruby-mysql

Then install the Rails gem with dependencies.
  gem install --remote rails

To check : gem list --local

I have those on my machine :
actionmailer (1.2.1)
actionpack (1.12.1)
actionwebservice (1.1.2)
activerecord (1.14.2)
activesupport (1.3.1)
rails (1.1.2)
rake (0.7.1)
sources (0.0.1)

I guess that the mysql gem which does not appear here is in fact set
up by the ruby-mysql package, at least on Mandriva. It works, whereas
"gem install mysql -- --with-mysql-config=`which mysql_config`"
seems to require the Ruby headers and asks what version of ruby-mysql
you want.

Setup the config/database.yml, not forgetting to set,
if necessary, the path to a non-standard socket :

development:
   adapter: mysql
   database: mydatabase
   username: myuser
   password: mypassword
   host: localhost
   socket: /path/to/nonstandard.sock

Make sure that your MySQL database does not use the "old password"
system (see in my.cnf and check with  mysql_fix_privilege_tables)

Create a table with the proper name (for example "recipes" all
lowercase, plural if you follow
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html)

Make sure that this table has a primary key called "id" (all
lowercase, integer, auto increment, primary)

Make sure that your user can access the database and the table

Then try
  ruby script/generate scaffold Recipe
If you don't get any error message, it looks good.

Then
  ruby script/server

and browse to http://localhost:3000/recipe

Should Work First Time (TM) :-)))

-- Jean Marc
seth b. (Guest)
on 2006-06-07 14:23
(Received via mailing list)
I know this question is about Linux - but for the benefit of others
searching for this problem...

I had this on windows until I installed the newest mysql/ruby bindings
available here:

http://www.vandomburg.net/pages/mysql-ruby-windows
This topic is locked and can not be replied to.