can’t connect to local mysql server through socket ‘/tmp/mysql.sock’ (2) Homebrew – How I fixed it.

My error was “can’t connect to local mysql server through socket ‘/tmp/mysql.sock’ (2) homebrew” and I was just going crazy trying to fix it, maybe just like you. I got this error when I installed MySQL through homebrew, when I did the MySQL command “mysql” in my terminal.

What fixed this problem for me was deleting MySQL and I used this command since I knew it was there,

BUT make sure you don’t have anything valuable there of course

rm -rf /usr/local/var/mysql/

Then I went ahead and removed MySQL from HomBrew

brew remove mysql

Then, of course, I went ahead and installed it again.

brew install mysql

About the Author: Edwin Diaz Edwin Diaz is an Engineer / Programmer / Web developer, Instructor and Entrepreneur. Hobbies Include... traveling , biking, rollerblading , swimming, hiking , and writing. Personal Note: I believe in the higher power and I'm doing my part in giving without expecting to receive. I love helping people and I plan to leave my mark on this earth by doing all the best I can to help every human being I encounter.

3 comments On can’t connect to local mysql server through socket ‘/tmp/mysql.sock’ (2) Homebrew – How I fixed it.

  • Anyone coming across these command, STOP!!!!!

    SQL stores your databases in /usr/local/var/mysql/ so, if like me, you come across an issue with starting your sql server, this will delete all your work.

    A very dangerous command, because they are permanently deleted.

  • I have completed your HTML CSS course in Udemy and now finding difficult to get a proof of work. People nowadays require certificates and other materials to show that we have knowledge in that.
    So I kindly wish you to provide a certificate.

Leave a reply:

Your email address will not be published.

Site Footer