简体   繁体   中英

MySQL installed via HomeBrew Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I've been searching for hours about this issue i'm having.

I have installed mysql@5.7 in my mac osx Monterey 12.0.1 with M1 chip using Homebrew.

I've been following this tutorial that helped me install mysql version 5.7. I'm specifying this version because i'm recreating a production environment on local.

At the step where I need to secure my mysql installation I type user root password and get this error Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) .

I have read many ways to fixing this but I can't make it work with any of those because most of them don't relate to homebrew or don't work well for me.

I have the service running using the brew services start mysql@5.7 command and this doesn't seem fixing the issue.

Is there any possibility I can't make it run because I have an M1 chip?

Do you have the mysql.sock in your /tmp?

You can make a symlink, depending on your installation

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

I researched again and remembered that I had previously installed a MySQL 8.X version. I uninstalled it only using the brew uninstall command. This wasn't enough and I made sure I deleted all the mysql related files and folders from my computer.

After that I retried installing MySQL 5.7 as a completely fresh install. Then at this same step where I had trouble before I didn't have any issue, I followed the installation and now is up and running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM