重庆思庄Oracle、Redhat认证学习论坛

标题: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/... [打印本页]

作者: jiawang    时间: 2018-7-5 16:33
标题: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/...

操作系统:RHEL7.3  64
mySQL版本:mysql-5.6.40

报错如下:
[root@strong ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to localMySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决办法:
[root@strong ~]# service mysql start
Starting MySQL. SUCCESS!
[root@strong ~]# ps -A | grep -i mysql
7349 pts/3    00:00:00 mysqld_safe
7446 pts/3    00:00:00 mysqld
[root@strong ~]# kill -9 7349
[root@strong ~]# kill -9 7446
[root@strong ~]# /etc/init.d/mysql restart
ERROR! MySQL server process #7446 is not running!
Starting MySQL. SUCCESS!
[root@strong~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.40

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>












欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2