好久不用mysql,今天突然想用的時候, mysql -uroot -p 直接報了下麵的錯誤 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) mac可以在設置裡面 ...
好久不用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/
這樣就好了