Database can't connect -


#1

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:inconnect’
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:innew’
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:insend’
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:inconnection=’
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:inconnection’
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


#2

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


#3

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?


#4

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