ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2)
时间: 2023-08-25 17:11:41 浏览: 172
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这个错误提示表示无法通过socket连接到本地的MySQL服务器。解决这个问题有几个步骤。首先,检查MySQL服务器是否正在运行。可以使用命令sudo service mysql status来检查MySQL服务器的状态。如果未运行,请使用sudo service mysql start命令启动它。接下来,检查MySQL配置文件中的socket路径是否正确。可以通过编辑my.cnf文件来配置socket路径。如果my.cnf文件不存在,则需要创建一个,并在其中添加正确的socket路径。以中的配置为例,将my.cnf文件保存在适当的位置,并确保socket路径与MySQL服务器的配置相匹配。最后,重启MySQL服务器以使更改生效。完成这些步骤后,如果看到中的提示,表示MySQL服务器启动成功。现在您应该能够成功连接到本地MySQL服务器了。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [brew 运行mysql ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql....](https://blog.csdn.net/qq_24909089/article/details/126936656)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* *3* [解决 ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ ...](https://blog.csdn.net/weixin_54061333/article/details/123579034)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文