Rails socket issue


#1

I don’t suppose there are any Rails users that could help me out with a problem I’m having. I’m new to Rails and to web programming generally and I’m trying to get my first Rails app deployed on-line. I’m stuck because I can’t run the rake db: migrate command to set up my production database. I’m using passenger, and I’ve got my app files where they need to be, as well as my database created, but when I run rake db:migrate using SSH (I use winSCP), I get this error:

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

I’m not sure where to go from here, and I could really use some help!
Thanks!


#2

turns out the problem was that I was using “hostname” instead of “host” in my database.yml file.


#3

I’m having this same problem. Could you tell me exactly how you fixed it, or is there anyone else who can?


#4

hi,
I have the same problem:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

this problem happens when i call mysql_real_escape_string without connecting to DB, but do we really need to connect to DB first?
i do need to know why this happening! and how to fix it.
Thanks,
MK


#5

Need a connection first. The function will fallback to the last known connection - if one doesn’t exist then you’ll receive an error.

http://au.php.net/mysql_real_escape_string

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost