# Can't connect to local MySQL server

**URL:** <https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549>\
**Category:** Rails\
**Created:** [September 26, 2007, 6:04am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549 "2007-09-26T06:04:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jalal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jalal](https://www.ruby-forum.com/u/jalal)\
**Post date:** [September 26, 2007, 6:04am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549/1 "2007-09-26T06:04:21Z")

</div>

hello everyone, i am new to ROR.

i am just trying to run a simple application which will show some data  
from database, i have done it in my local machine. But when i tried to  
do the same thing in my “Dreamhost” shared hosting. I got an error.

i used the Rake tool and successfully migrated a model (using SSH  
client tool). The table was successfully created hosting db server, so  
i thought there will be no problem in getting the database server. But  
when i call the page this error comes:

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/  
mysqld.sock’ (2)

i checked that database.yml file is porperly configured, and i think  
if it wasn’t configured properly then how the table get created…

so what can be the problem , can anyone help?

thanks in advance.

---

<div class="post-metadata">

**Author:** ![jalal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jalal](https://www.ruby-forum.com/u/jalal)\
**Post date:** [September 26, 2007, 11:24am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549/2 "2007-09-26T11:24:07Z")

</div>

wierd - have you checked that mysql is running? i agree that if the  
table  
was created then surely the sock you specified must be correct? I have  
seen  
that error when mysql isn’t running. Im not really very clued up on this  
but  
that’s my 2cents worth 🙂

ivor

---

<div class="post-metadata">

**Author:** ![jalal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jalal](https://www.ruby-forum.com/u/jalal)\
**Post date:** [September 26, 2007, 11:32am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549/3 "2007-09-26T11:32:15Z")

</div>

Just checking the obvious - are you definately running in production  
mode?

I use site5 rather than dreamhost however I have to set the following in  
/config/environment.rb:

ENV[‘RAILS\_ENV’] ||= ‘production’

Luke

---

<div class="post-metadata">

**Author:** ![jalal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jalal](https://www.ruby-forum.com/u/jalal)\
**Post date:** [September 27, 2007, 6:32am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server/115549/4 "2007-09-27T06:32:00Z")

</div>

thanks for your reply, my problem is solved. i have done everything  
properly  
as the hosting service suggested. returning from the office i checked  
back  
the website, and it responded as it should. so may be there was some  
problem  
in the hosting.
