MySQL can't connect

Subscribe to MySQL can't connect 4 post(s), 3 voice(s)

 
Avatar Scott O 2 post(s)

After failing to install the sqlite3-ruby gem, I changed the database.yml file to use MySQL. When I run the ‘fiveruns’ app I have created with ’$rails fiveruns’, I get the “Welcome Aboard” page at localhost:3000, but when I click on ‘About your application’s development environment’, it says:
Can’t connect to local MySQL server through socket ’/tmp/mysql.sock’ (2)
I know that mysql.sock is located at ~/fiveruns/mysql/tmp. What can I do to fix this?

 
Avatar Rachel G Administator 48 post(s)

Hi Scott,
Could you try to connect to MySQL the following way (after setting up the environment to use the RM-Install binaries):
user@ubuntu:~/rminstall$ mysql -u root -S /home/user/rminstall/mysql/tmp/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.45
Type ‘help;’ or ’\h’ for help. Type ’\c’ to clear the buffer.
mysql>
This tells the mysql client to use the RM-Install specific Unix domain socket to connect to the server.

 
Avatar ttdavett 3 post(s)

I am having the exact same problem and have been unable to find a solution for hours. I was able to connect to the MySQL monitor, but what do I do then? This still did not help. Have any solutions to this problem been found?

 
Avatar ttdavett 3 post(s)

I have solved this issue. For anyone coming accross this problem, you need to add a socket line to your database.yml file:
socket: /Applications/rminstall-1.1-0/mysql/tmp/mysql.sock.
This is shown in the sample database file. This path must also be specified in CocoaMySQL.