Hi,
I am having Mysql connection problem for my first AddressBook
application (which I took it from
http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/)
I have gem installed the latest ruby, rails, lighttpd, fastcgi,
mysql-4.1.14 on linux. Everything looks good. When I do:
mysql -h localhost -u test -ptest -D AddressBook
mysql> SELECT COUNT() FROM contacts;
±---------+
| COUNT() |
±---------+
| 1 |
±---------+
1 row in set (0.00 sec)
And I have config/database.yml as
development:
adapter: mysql
database: AddressBook
username: test
password: test
#socket: /var/lib/mysql/mysql.sock
Connect on a TCP socket. If omitted, the adapter will connect on
the
domain socket given by socket instead.
host: localhost
port: 3306
Here’s the stack trace:
Parameters: {“action”=>“index”, “controller”=>“contact”}
Contact Count (0.000000) Mysql::Error: Lost connection to MySQL
server during query: SELECT COUNT(*) FROM contacts
ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL
server during query: SELECT COUNT(*) FROM contacts ):
/home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
log' /home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in
execute’
/home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:322:in
select' /home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:175:in
select_one’
/home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in
select_value' /home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/base.rb:518:in
count_by_sql’
/home/aaronlee/ruby/gemrepository/gems/activerecord-1.13.2/lib/active_record/base.rb:511:in
count' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:167:in
count_collection_for_pagination’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:188:in
paginator_and_collection_for' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:124:in
paginate’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/scaffolding.rb:101:in
list' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/scaffolding.rb:94:in
index’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in
perform_action_without_filters' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in
perform_action_without_benchmark’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /home/aaronlee/ruby/install-1.8.4//lib/ruby/1.8/benchmark.rb:293:in
measure’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in
perform_action’
/home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in
process_without_session_management_support' /home/aaronlee/ruby/gemrepository/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in
process’
/home/aaronlee/ruby/gemrepository/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' /home/aaronlee/ruby/gemrepository/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in
process_request’
/home/aaronlee/ruby/gemrepository/gems/rails-1.0.0/lib/fcgi_handler.rb:53:in
process!' /home/aaronlee/ruby/install-1.8.4//lib/ruby/site_ruby/1.8/fcgi.rb:600:in
each_cgi’
/home/aaronlee/ruby/install-1.8.4//lib/ruby/site_ruby/1.8/fcgi.rb:597:in
each_cgi' /home/aaronlee/ruby/gemrepository/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in
process!’
/home/aaronlee/ruby/gemrepository/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in
`process!’
/home/aaronlee/ruby/AddressBook/public/dispatch.fcgi:24
Any ideas? How do I go about debugging this problem? Can I have a more
verbose mode to know whether it’s talking to my localhost MySQL?
-Aaron