1. 程式人生 > >ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

put art input err start you serve ren copy

[root@localhost etc]# ps -A|grep mysql
 26080 pts/0    00:00:00 mysql

[root@localhost etc]# kill -9 26080

[root@localhost etc]# ps -A|grep mysql

[root@localhost etc]# mysql restart
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")

[root@localhost etc]# /etc/init.d/mysql restart
Restarting mysql (via systemctl):                          [  OK  ]

[root@localhost etc]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.38-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'