I am trying to connect to a mysql server running on a Fedora machine listening on port 3306 at the socket /var/lib/mysql/mysql.sock
The mysql client is an ROR application which has been launched on a ubuntu machine using vagrant. From within the client the error occurs.
Mysql2::Error at / Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I have tried the following
- Added in the fedora machine, socket="/var/lib/mysql/mysql.sock" in the my.cnf file and checked. It didnt work.
- Added in the database.yml file, socket="/var/lib/mysql/mysql.sock". It gives the similar error. Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
- I have tried doing the chown mysql:mysql /var/lib/mysql/. Also chown mysql:mysql /var/run/mysqld/. Earlier the mysqld.sock was not present in the Ubuntu machine. I created one and did chown. But didnt work.
- I have tried disk clean since in some forums it has been told that this can be due to disk space crunch. But this also didnt help.
I have been stuck on this problem and have tried all possible ways for the last 2 days. This is the only road-block for the project. Please help me get out of this situation as I am going crazy figuring out how this can be resolved. Any quick help is very highly appreciated. Thanks in advance.