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 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts