简体   繁体   English

MySQL 通过 HomeBrew 安装错误:无法通过套接字“/tmp/mysql.sock”连接到本地 MySQL 服务器 (2)

[英]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.我已经使用 Homebrew 在我的带有 M1 芯片的 mac osx Monterey 12.0.1 中安装了 mysql@5.7。

I've been following this tutorial that helped me install mysql version 5.7.我一直在关注帮助我安装 mysql 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) .在我需要保护我的 mysql 安装的步骤中,我输入用户 root 密码并收到此错误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.我使用brew services start mysql@5.7命令运行该服务,这似乎无法解决问题。

Is there any possibility I can't make it run because I have an M1 chip?有没有可能因为我有 M1 芯片而无法让它运行?

Do you have the mysql.sock in your /tmp?您的 /tmp 中有 mysql.sock 吗?

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.我又研究了一下,记得之前安装了一个MySQL 8.X版本。 I uninstalled it only using the brew uninstall command.我只使用 brew uninstall 命令卸载了它。 This wasn't enough and I made sure I deleted all the mysql related files and folders from my computer.这还不够,我确保从我的计算机中删除了所有与 mysql 相关的文件和文件夹。

After that I retried installing MySQL 5.7 as a completely fresh install.之后,我重新尝试安装 MySQL 5.7 作为全新安装。 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.然后在我没有任何问题之前遇到问题的同一步骤中,我按照安装进行操作,现在已经启动并运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `connect':无法通过套接字'/tmp/mysql.sock'(2)连接到本地MySQL服务器(Mysql2 :: Error) - `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error) Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' - Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 无法通过套接字'/tmp/mysql.sock'(2)错误连接到本地MySQL服务器 - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) error (2002)错误:无法通过套接字'/tmp/mysql.sock'连接到本地MySQL服务器(46) - (2002) Error:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46) 警告:mysql_connect():无法通过套接字“ /tmp/mysql.sock”连接到本地MySQL服务器(2) - Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 缺少 mysql.sock; 产生操作错误:(2002,“无法通过套接字连接到本地 MySQL 服务器‘/tmp/mysql.sock’(2)”) - Missing mysql.sock; yielding OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") 将R连接到MySQL-“无法连接到数据库:错误:无法通过套接字'/tmp/mysql.sock'(2)连接到本地MySQL服务器” - Connecting R to MySQL - “Failed to connect to database: Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)” (2002,“无法通过套接字'/tmp/mysql.sock'(2)连接到本地MySQL服务器”) - (2002, “Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)”)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM