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.
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