Matt Elhotiby
Matt Elhotiby

Reputation: 44066

Problem connecting MySQL to Rails

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) I have a Rails application and I am getting this error. I have no idea how to find mysql connect it to mysql.sock. I am pretty sure i can go into config/database.yml and set the mysql.sock but where is it or do I need to reinstall it?

When I do locate mysql i get alot of results including the two below

/usr/include/mysql
/usr/bin/mysql

but when I locate mysql.sock I get nothing

Upvotes: 1

Views: 191

Answers (1)

Doon
Doon

Reputation: 20232

Is mysql actually running, and set to listen on the socket interface. Make sure that the server is started/configured.

well first check to see if it is running

ps auxwww | grep mysql

should do that, if not, then

/etc/init.d/mysql start 

or

service mysql start   

as root (or via sudo, should start it). but if it is running the socket should be in

/var/run/mysqld/mysqld.sock 

Upvotes: 2

Related Questions