MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.

Posted hch的随笔 成功的秘诀在于恒心—迪斯雷利

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.相关的知识,希望对你有一定的参考价值。

 

[[email protected] mysql3307]# /opt/mysql3307/bin/mysql -upisp [email protected]123
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Cant connect to local MySQL server through socket /tmp/mysql.sock (2)

 

解决办法

[[email protected] tmp]# ln -s /opt/mysql3307new/mysql-3307.sock mysql.sock
[[email protected] tmp]# ll -thr
total 4.9M
-rw------- 1 root  root   783 May 26  2017 yum_save_tx-2017-05-26-09-23etoC8C.yumtx
-rw-r--r-- 1 root  root    42 Jan  8  2018 network.bak
-rw------- 1 root  root   248 Jan  9  2018 yum_save_tx-2018-01-09-11-33Y0mCc_.yumtx
-rw------- 1 root  root  1.7K Jan  9  2018 yum_save_tx-2018-01-09-11-48cbmJd8.yumtx
-rw------- 1 root  root   513 Jan  9  2018 yum_save_tx-2018-01-09-12-047IB4sD.yumtx
-rw-r--r-- 1 root  root   521 Jan  9  2018 centos6_haikou_nanshu.repo
-rw-r--r-- 1 root  root  4.5M Jan 30  2018 zabbixagent_for_linux.tar.gz
-rw-r--r-- 1 root  root  2.5K Jan 30  2018 zabbix_install.bash
-rw-rw-rw- 1 mysql mysql  708 Mar 16  2018 sql.csv
-rw-r--r-- 1 root  root    32 Oct 25 10:39 lock.txt
drwxr-xr-x 2 root  root  4.0K Oct 25 12:31 yum-bak
-rw-r--r-- 1 root  root     0 Oct 27 09:19 mysql-3307.pid.shutdown
-rw------- 1 mysql mysql    5 Oct 27 09:27 mysql-3307.sock.lock
-rw-r--r-- 1 root  root  299K Oct 28 14:20 connect.log
lrwxrwxrwx 1 root  root    33 Oct 28 14:20 mysql.sock -> /opt/mysql3307new/mysql-3307.soc

 

以上是关于MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.的主要内容,如果未能解决你的问题,请参考以下文章

解决MySQL报错ERROR 2002 (HY000)

Problemxampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server t(代

长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys

连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mys

连接数据报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql

启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib