MySQL Can't Connect To Local MySQL Server Through Socket '/var/run/mysqld/mysqld.sock'

Posted by Weston Ganger on October 25, 2015

I was getting the following error with mysql and my rails app.

To fix it we just create a symlink.

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

That will fix it until you restart your system because the /tmp folder is temporary.

To create this link each time you restart, I add it to the end of my ~/.profile

# ~/.profile - Add this line to the end
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

Related External Links:

Posted in Linux and Tagged with mysql database linux 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts