Forum: Ruby on Rails Database can't connect -

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.
Sean C. (Guest)
on 2006-05-31 10:35
I'm sorry guys. I'm really still such a newbie at this. i've been having
trouble getting my Rails apps to run on Dreamhost, and I think it might
be a problem with the database connection. Anyway, I read on Code
Snippets that I should do this:

[rhod]$ ruby -Iconfig -renvironment -e "p ActiveRecord::Base.connection"

to find out if my database.yml file is connecting properly. This is the
result i got:

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:331:in
`real_connect': Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2) (MysqlError)
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:331:in
`connect'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in
`initialize'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in
`new'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in
`mysql_connection'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
`send'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
`connection_without_query_cache='
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/query_cache.rb:54:in
`connection='
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in
`retrieve_connection'
        from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
        from -e:1

I see the word "error" and that the app can't connect to the database
through the socket, but I'm lost as to the implications of this message
or what course I would take to fix it. Any ideas? TIA
Alex W. (Guest)
on 2006-05-31 10:47
sean colquhoun wrote:
> I'm sorry guys. I'm really still such a newbie at this. i've been having
> trouble getting my Rails apps to run on Dreamhost, and I think it might
> be a problem with the database connection. Anyway, I read on Code
> Snippets that I should do this:
>
> I see the word "error" and that the app can't connect to the database
> through the socket, but I'm lost as to the implications of this message
> or what course I would take to fix it. Any ideas? TIA

Tried here? http://wiki.dreamhost.com/index.php/Ruby_on_Rails
Sean C. (Guest)
on 2006-05-31 11:01
Alex W. wrote:
> sean colquhoun wrote:
>> I'm sorry guys. I'm really still such a newbie at this. i've been having
>> trouble getting my Rails apps to run on Dreamhost, and I think it might
>> be a problem with the database connection. Anyway, I read on Code
>> Snippets that I should do this:
>>
>> I see the word "error" and that the app can't connect to the database
>> through the socket, but I'm lost as to the implications of this message
>> or what course I would take to fix it. Any ideas? TIA
>
> Tried here? http://wiki.dreamhost.com/index.php/Ruby_on_Rails

Yep. And here too: http://www.railshosting.org/#dreamhost

I went through my log files, though, after reading your post, and i keep
getting errors that say my database doesn't exist. I even accessed the
database manually, cutting and pasting the information directly from my
database.yml file and triple-checking the database name.

I've seen varying setups for the database.yml file. Do I need to add
something, perhaps an explicit "socket: something" line? I actually
don't even know what a socket would be wriiten like. A name? A type? A
number, like a port? Yes or no?
Sean C. (Guest)
on 2006-05-31 11:16
I am such an idiot.

Three weeks banging my head against the table, and guess what has been
tripping me up all this time?
Yep. Uppercase table names.

*HHIS*

Anyway, thanks Alex. You got me looking in the right place.

sean
This topic is locked and can not be replied to.