长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys
Posted vivi~
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys相关的知识,希望对你有一定的参考价值。
mac上安装过mysql:
然而,尝试连接时报错:
$ mysql -u root -p Enter password: ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/tmp/mysql.sock\' (2)
尝试去查看mysql.socket文件,发现没有。。
$ which mysql
/usr/local/bin/mysql
然后试试重启mysql:
$ mysql.server start
Starting MySQL
. SUCCESS!
哎 ,说明咱的mysql还能用的嘛,其实内心很担心是不是装了zsh导致的不能启动mysql。。
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \\g. Your MySQL connection id is 4 Server version: 5.7.17 Homebrew
哈哈 这么简单就启动了 可以查看各种内容了,还是要多动多练才可以
$ mysql.server start $ mysql.server restart $ mysql.server stop $ mysql.server status $ mysql -u root -p $ sudo mysql #以root权限登录
以上是关于长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys的主要内容,如果未能解决你的问题,请参考以下文章
MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.
Problemxampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server t(代