# Database can't connect -

**URL:** <https://www.ruby-forum.com/t/database-cant-connect/62072>\
**Category:** Rails\
**Created:** [May 31, 2006, 8:35am UTC](https://www.ruby-forum.com/t/database-cant-connect/62072 "2006-05-31T08:35:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 31, 2006, 8:35am UTC](https://www.ruby-forum.com/t/database-cant-connect/62072/1 "2006-05-31T08:35:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 31, 2006, 8:47am UTC](https://www.ruby-forum.com/t/database-cant-connect/62072/2 "2006-05-31T08:47:19Z")

</div>

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](http://wiki.dreamhost.com/index.php/Ruby_on_Rails)

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 31, 2006, 9:01am UTC](https://www.ruby-forum.com/t/database-cant-connect/62072/3 "2006-05-31T09:01:31Z")

</div>

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](http://wiki.dreamhost.com/index.php/Ruby_on_Rails)

Yep. And here too: [http://www.railshosting.org/#dreamhost](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?

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 31, 2006, 9:16am UTC](https://www.ruby-forum.com/t/database-cant-connect/62072/4 "2006-05-31T09:16:36Z")

</div>

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
