Hi, I try to follow this tutorial: http://manuals.rubyonrails.com/read/chapter/38 This is my app/controllers/todo_controller.rb file: class TodoController < ApplicationController model :todo scaffold :todo end When I open http://localhost:3000/todo : Errno::ENOENT in Todo#index No such file or directory - /tmp/mysql.sock script/server:49 Show framework trace /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `initialize'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `new'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `real_connect'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:39:in `mysql_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `send'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `connection='' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:108:in `retrieve_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:239:in `connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:461:in `count_by_sql'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:454:in `count'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:154:in `count_collection_for_pagination'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:171:in `paginator_and_collection_for'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in `paginate'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:101:in `list'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:94:in `index'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:94:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:89:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:89:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' Request Parameters: None Show session dump --- flash: !ruby/hash:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} How can I solve this error???? Thank you.
There is a problem with your mysql configuration... its trying to connect to the domain socket at /tmp/mysql.sock check your mysql conf to see where the socket is... you can put MYSQL_UNIX_PORT=path_to_mysql_socket export MYSQL_UNIX_PORT in /etc/profile which would probably take care of the problem. Akbar wrote:>Hi, I try to follow this tutorial: >http://manuals.rubyonrails.com/read/chapter/38 > >This is my app/controllers/todo_controller.rb file: >class TodoController < ApplicationController > model :todo > scaffold :todo >end > >When I open http://localhost:3000/todo : >Errno::ENOENT in Todo#index >No such file or directory - /tmp/mysql.sock >script/server:49 >Show framework trace >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `initialize'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `new'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in `real_connect'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:39:in `mysql_connection'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `send'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `connection='' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:108:in `retrieve_connection'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:239:in `connection'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:461:in `count_by_sql'' >/usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:454:in `count'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:154:in `count_collection_for_pagination'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:171:in `paginator_and_collection_for'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in `paginate'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:101:in `list'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:94:in `index'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' >/usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' >/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' >/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' >/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service'' >/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >/usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' >/usr/lib/ruby/1.8/webrick/server.rb:144:in `start'' >/usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' >/usr/lib/ruby/1.8/webrick/server.rb:94:in `start'' >/usr/lib/ruby/1.8/webrick/server.rb:89:in `each'' >/usr/lib/ruby/1.8/webrick/server.rb:89:in `start'' >/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' >/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' >/usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' > > > >Request >Parameters: None > >Show session dump > >--- >flash: !ruby/hash:ActionController::Flash::FlashHash {} >Response >Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > >How can I solve this error???? > >Thank you. > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I had this problem a couple of evenings ago, when setting up a new box. The mysqld.sock was in /var/run/mysqld/mysqld.sock. My solution/hack was to symlink /tmp/mysql.sock to /var/run/mysqld/mysqld.sock. Worked for me, so worth a try? Cheers James Sean T Allen wrote:> There is a problem with your mysql configuration... > > its trying to connect to the domain socket at > > /tmp/mysql.sock > > check your mysql conf to see where the socket is... > > you can put > > MYSQL_UNIX_PORT=path_to_mysql_socket > export MYSQL_UNIX_PORT > > in /etc/profile > > which would probably take care of the problem. > > > Akbar wrote: > >> Hi, I try to follow this tutorial: >> http://manuals.rubyonrails.com/read/chapter/38 >> >> This is my app/controllers/todo_controller.rb file: >> class TodoController < ApplicationController >> model :todo >> scaffold :todo >> end >> >> When I open http://localhost:3000/todo : >> Errno::ENOENT in Todo#index >> No such file or directory - /tmp/mysql.sock >> script/server:49 >> Show framework trace >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in >> `initialize'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in >> `new'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/vendor/mysql411.rb:43:in >> `real_connect'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:39:in >> `mysql_connection'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in >> `send'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in >> `connection='' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:108:in >> `retrieve_connection'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:239:in >> `connection'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:461:in >> `count_by_sql'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:454:in >> `count'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:154:in >> `count_collection_for_pagination'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:171:in >> `paginator_and_collection_for'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in >> `paginate'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:101:in >> `list'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:94:in >> `index'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in >> `send'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in >> `perform_action_without_filters'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in >> `perform_action_without_benchmark'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in >> `perform_action_without_rescue'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in >> `measure'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in >> `perform_action_without_rescue'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in >> `perform_action'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in >> `send'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in >> `process'' >> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in >> `dispatch'' >> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in >> `handle_dispatch'' >> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in >> `service'' >> /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >> /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >> /usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' >> /usr/lib/ruby/1.8/webrick/server.rb:144:in `start'' >> /usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' >> /usr/lib/ruby/1.8/webrick/server.rb:94:in `start'' >> /usr/lib/ruby/1.8/webrick/server.rb:89:in `each'' >> /usr/lib/ruby/1.8/webrick/server.rb:89:in `start'' >> /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' >> /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' >> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in >> `dispatch'' >> >> >> >> Request >> Parameters: None >> >> Show session dump >> >> --- flash: !ruby/hash:ActionController::Flash::FlashHash {} >> Response >> Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} >> >> How can I solve this error???? >> >> Thank you. >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-- * James Knight * *goodtechnology*
On Thu, 2005-07-28 at 09:54 +0100, James Knight wrote:> I had this problem a couple of evenings ago, when setting up a new box. > The mysqld.sock was in /var/run/mysqld/mysqld.sock. > > My solution/hack was to symlink /tmp/mysql.sock to > /var/run/mysqld/mysqld.sock. > > > Worked for me, so worth a try? > > Cheers > JamesOr add the following line to the appropriate section(s) of config/database.yml: socket: /var/run/mysqld/mysqld.sock