I was retaking my self taught course of RoR yesterday and I started getting this error when accessing the database, each time I wanted to generate the scaffolding of one model:
Can't connect to local MySQL server through socket '/tmp/mysql.sock'Oh well, I thought, aggghh. When I tried to install php, ror, mysql, etc... I did a great mess here, and although I hadn't had any problem with php (once I installed xampp), seems like I have a separate mysql installation (the remaining of the first, separated one, I tried first).
After trying to find out what was the problem with that socket, specially because it shouldn't look at that file, but at one under xampp files, I found a quicker solution:
In the config/database.yml file, I replaced all appearances of localhost with 127.0.0.1.
And voila, it started working. Although it's not very efficient, as it makes every connection to go through TCP, and not via a socket, as it would do if the host was localhost.
I think I'll have to take my time once and clean this horrible mess, but by the moment it works.