43432223hhh 发表于 2017-3-22 09:57:04

Can't connect to local MySQL server through socket

记一次MySQL启动故障 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

故障现象:

1
2
3
4
5
6
7
8
9
10
11
# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
#


# service mysqld restart
Stopping mysqld:                                          
MySQL Daemon failed to start.
Starting mysqld:                                          
#






查找MySQL的错误日志在哪里

1
2
3
# find / -iname '*.err'
/var/lib/mysql/CentOS.err
#





分析错误


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# tail /var/lib/mysql/CentOS.err
170321 09:48:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: error while loading shared libraries: libstdc++.so.6: failed to map segment from shared object: Permission denied
170321 09:48:17 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
#

# find / -iname '*libstdc++.so.6*'
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.13
/usr/lib/libstdc++.so.6.0.22
#

# ll /usr/lib/libstdc++.so.6*
lrwxrwxrwx. 1 root   root      19 3月12 10:36 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.22
-rwxr-xr-x. 1 root   root    942040 11月 21 2013 /usr/lib/libstdc++.so.6.0.13
-rwxr-xr-x. 1 chunli chunli 9099895 3月12 07:27 /usr/lib/libstdc++.so.6.0.22
#








搜了一会儿,也没有找到合适的解决方法,倒是看到不少SElinux的身影
尝试关闭SElinux


1
2
3
4
5
6
7
8
# getenforce
Enforcing
# setenforce 0
# getenforce
Permissive
# service mysqld restart
Stopping mysqld:                                          
Starting mysqld:                                          





问题并没有直接解决,而是绕过去了,有时间再啃啃了,先做手头上的事儿。


页: [1]
查看完整版本: Can't connect to local MySQL server through socket