linux错误2002

在Linux安装MySQL有时候会出现[mysql]ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 这样的错误,具体解决办法如下:


[root@localhost  bin]# ./mysql  -u  root  -q
ERROR 2002 (HY000): Can't connect to local MySQL server through socket ' /var/lib/mysql/mysql.sock' (2)
[root@r710-1 /]# vi /etc/my.cnf
##########添加如下内容:
[client]
socket=/var/lib/mysql/mysql.sock


##########保存退出后,
##########重启mysql
[root@r710-1 /]# service mysqld restart
Shutting down MySQL.                                       [  OK  ]
Starting MySQL.                                            [  OK  ]

你可能感兴趣的:(linux,mysql,server,socket,red,hat)