# Re: a newbie doomed in the first introduction to rails

**URL:** <https://www.ruby-forum.com/t/re-a-newbie-doomed-in-the-first-introduction-to-rails/63933>\
**Category:** Rails\
**Created:** [January 22, 2006, 8:23am UTC](https://www.ruby-forum.com/t/re-a-newbie-doomed-in-the-first-introduction-to-rails/63933 "2006-01-22T08:23:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Talha\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c2a13f/32.png) [@Talha\_O](https://www.ruby-forum.com/u/Talha_O)\
**Post date:** [January 22, 2006, 8:23am UTC](https://www.ruby-forum.com/t/re-a-newbie-doomed-in-the-first-introduction-to-rails/63933/1 "2006-01-22T08:23:59Z")

</div>

Hello,

Thank you for the fast responses, I really appreciate. I really enjoy  
being  
a part of such a great community.

I still could not solve my problem. To make sure that I can not connect  
beacuse of access rights, I have started mysql server  
–skip-grant-tables  
option. (I have read the part of the manual about access rights, which I  
was  
to read in this list, but 4 AM in the morning, I had hard time to  
decipher  
what I read). User name and passwords are no longer required. I can  
even  
connect with empty usernames and passwords with mysql administrator  
program.

I may have problem with this socket or TCP/IP thing. The database.yml  
file  
that is generated by rails looks little different from what I see in the  
book. Below is my database.yml file.

===================================

# MySQL (default setup). Versions 4.1 and 5.0 are recommended.

# 

# Get the fast C bindings:

# gem install mysql

# (on OS X: gem install mysql – --include=/usr/local/lib)

# And be sure to use new-style password hashing:

# [http://dev.mysql.com/doc/refman/5.0/en/old-client.html](http://dev.mysql.com/doc/refman/5.0/en/old-client.html)

development:  
adapter: mysql  
database: depot\_development  
username:  
password:

# socket: /path/to/your/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

# Warning: The database defined as ‘test’ will be erased and

# re-generated from your development database when you run ‘rake’.

# Do not set this db to the same as development or production.

test:  
adapter: mysql  
database: depot\_test  
username:  
password:

# socket: /path/to/your/mysql.sock

production:  
adapter: mysql  
database: depot\_production  
username:  
password:

# socket: /path/to/your/mysql.sock

==========================================

Below the error message in log/development in rails depot application

====================================================  
Rendering  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/templates/rescues/layout.rhtml  
(500 Internal Error)

Processing AdminController#index (for 127.0.0.1 at 2006-01-22 08:41:34)  
[GET]  
Parameters: {“action”=\>“index”, “controller”=\>“admin”}

Errno::ECONNREFUSED (No connection could be made because the target  
machine  
actively refused it. - connect(2)):  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/vendor/mysql.rb:108:in  
`initialize' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:108:in `new’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/vendor/mysql.rb:108:in  
`real_connect' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:in `connect’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:87:in  
`initialize' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in `new’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:37:in  
`mysql_connection' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `send’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:145:in  
`connection_without_query_cache=' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:in `connection=’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:106:in  
`retrieve_connection' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:518:in  
`count_by_sql' d:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:511:in `count’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/pagination.rb:167:in  
`count_collection_for_pagination' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:188:in `paginator\_and\_collection\_for’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/pagination.rb:124:in  
`paginate' /app/controllers/admin_controller.rb:8:in `list’  
/app/controllers/admin\_controller.rb:3:in `index' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `send’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:853:in  
`perform_action_without_filters' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in `perform\_action\_without\_benchmark’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `measure’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in `perform\_action’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:369:in  
`send' d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in `process\_without\_session\_management\_support’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/session\_management.rb:116:in  
`process' d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in `dispatch’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick\_server.rb:117:in  
`handle_dispatch' d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in `service’  
d:/apps/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' d:/apps/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread' d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start’  
d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread' d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start’  
d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each' d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start’  
d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start' d:/apps/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick\_server.rb:69:in  
`dispatch' d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0 /lib/commands/servers/webrick.rb:59 d:/apps/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require\_\_’  
d:/apps/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:18:in  
`require' d:/apps/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in `require’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0  
/lib/commands/server.rb:28  
d:/apps/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:18:in  
`require__' d:/apps/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require’  
d:/apps/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:214:in  
`require’  
script/server:3

Rendering  
d:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/templates/rescues/layout.rhtml  
(500 Internal Error)

=======================================================

Thank you again.

Talha

---

<div class="post-metadata">

**Author:** ![Talha\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c2a13f/32.png) [@Talha\_O](https://www.ruby-forum.com/u/Talha_O)\
**Post date:** [January 22, 2006, 9:19am UTC](https://www.ruby-forum.com/t/re-a-newbie-doomed-in-the-first-introduction-to-rails/63933/2 "2006-01-22T09:19:35Z")

</div>

Talha O. wrote:

> I still could not solve my problem. To make sure that I can not connect  
> beacuse of access rights, I have started mysql server  
> –skip-grant-tables  
> option.

And is your mysql server configured to listen on a TCP port? Can you  
telnet to that port manually to verify that you do not get “Connection  
refused”?

> I may have problem with this socket or TCP/IP thing. The database.yml  
> file  
> that is generated by rails looks little different from what I see in the  
> book. Below is my database.yml file.

It sounds like you should be using the “socket” keyword in your  
databases.yml, not the “host” and “port” keywords. Many \*nix  
distributions provide mysql packages that only listen on a filesystem  
socket, not on a TCP port.

To find the location of the socket on your filesystem, try this:

grep ^socket /etc/my.cnf

On my system, I get

socket = /var/run/mysqld/mysqld.sock

So in my databases.yml, I have

socket: /var/run/mysqld/mysqld.sock

If I use “host” and “port” in database.yml instead, I get the error  
you’re getting:

> Errno::ECONNREFUSED (No connection could be made because the target  
> machine  
> actively refused it. - connect(2)):

Ciao,  
Sheldon.

---

<div class="post-metadata">

**Author:** ![Talha\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c2a13f/32.png) [@Talha\_O](https://www.ruby-forum.com/u/Talha_O)\
**Post date:** [January 22, 2006, 9:45am UTC](https://www.ruby-forum.com/t/re-a-newbie-doomed-in-the-first-introduction-to-rails/63933/3 "2006-01-22T09:45:15Z")

</div>

i have a similar setup to you (mysql 5.0, windows xp sp2), and i connect  
using the host and port, rather than socket.

but in your database.yml file, you uncommented host, but left the port  
commented. it needs to be able to see both the host and port (3306 is  
the  
default mysql port).

maybe try it with port uncommented, host uncommented, and socket  
commented  
out?

* * *

John McGrath

> **[John McGrath: solutions architect focused on startups, sustainability, media.](https://www.fryolator.com/)**
>
> I work primarily with early stage startups, with an emphasis on companies involved in sustainability. I've mentored and presented at TechStars Sustainability and Greentown Labs, and created the Code Green series of AWS sustainability workshops.
