Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL (mysql_secure_installation) won't work after installing through homebrew: Can't connect through socket

When just installing mysql on OSX through homebrew like so: brew install mysql and I try to run the command mysql_secure_installation as brew suggests, it just gives me the following error:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I tried ALL SOLUTIONS from this thread: Can't connect to local MySQL server through socket homebrew

But alass nothing solved my problem. Any advice to debug?

When I try to check the existance of the socket file:
ls -al /tmp/mysql.sock
It says: No such file or directory.

Did Homebrew maybe forget to install something?

like image 545
mesqueeb Avatar asked Sep 15 '25 18:09

mesqueeb


1 Answers

Often this is because of permissions, did you try?

sudo chown -R _mysql:mysql /usr/local/var/mysql

sudo mysql.server start

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!