尝试解决:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock '(2)
2019-04-15 18:34
633 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/ZTJ_123/article/details/89317815
忽然之间,前一天还能使用mysql -uroot -p正常访问数据库,今天早上整了一个阿里云服务器之后(该不会这也影响吧),突然发现我的Mac连不上mysql了,mysql -uroot -p这个命令一直报Can't connect to local MySQL server through socket '/tmp/mysql.sock '(2) 。
于是在网上各种查资料,修是没修好,但是大致弄懂了sock文件的用处,参考了这篇文章亲测有效,解决。。。,但是我还是没解决。
又找啊找发现了这篇文章Mac上MySQL报错,其实没有仔细看,上面有一块,我标记了一下,mysqld_safe,就是这个看起啦好像是安全啥啥的东东:
直接:
sudo mysqld_safe的完整路径
然后回车:
因为我已经启动了似乎是某个服务,所以这里 already exists。
然后我又 open /tmp
然后再mysql -uroot -p 就可以正常操作了,具体有没有其他问题,作为菜鸟的我也不是很清楚,有大神看见的话欢迎传授哈
相关文章推荐
- 解决“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (60)”
- 解决“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)”
- 解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- mysql连接之ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2
- Mysql连接错误:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (
- 更换mysql数据目录后出现ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 的解决办法
- CentOS下面ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' 解决方法
- 阿里云报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock’
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 报错解决方案
- 记一次 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock’(2) 排错流程
- 解决mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- CentOS下面ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)