首页 > 代码库 > mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
好久不用mysql,今天突然想用的时候,
mysql -uroot -p
直接报了下面的错误
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)
mac可以在设置里面启动mysql,设置里面启动mysql的时候提示没有/usr/local/mysql/data的权限,
给予权限
sudo chown -R mysql:mysql /usr/local/mysql
发现还是没用,但是发现mysql当时是配置了链接
qiweijieMacBook-Pro:~ qiweijie$ ll /usr/local/mysql
lrwxr-xr-x 1 _mysql _mysql 27 2 26 2016 /usr/local/mysql -> mysql-5.7.11-osx10.9-x86_64
虽然给了mysql权限,还是只是给到了链接的权限,没有得到真正的mysql目录的权限
qiweijieMacBook-Pro:~ qiweijie$ ll /usr/local/mysql-5.7.11-osx10.9-x86_64/ total 48 ... drwxr-x--- 16 qiweijie staff 544 10 7 12:18 data ....
sudo chown -R mysql:mysql /usr/local/mysql-5.7.11-osx10.9-x86_64/
这样就好了
mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。