[root@t1 ~]# tail /tmp/zabbix_server.log
23392:20160303:131022.598 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
23392:20160303:131022.598 Database is down. Reconnecting in 10 seconds.
23392:20160303:131032.598 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
23392:20160303:131032.598 Database is down. Reconnecting in 10 seconds.
23392:20160303:131042.599 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
23392:20160303:131042.599 Database is down. Reconnecting in 10 seconds.
23392:20160303:131052.599 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
23392:20160303:131052.599 Database is down. Reconnecting in 10 seconds.
23392:20160303:131102.600 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
23392:20160303:131102.600 Database is down. Reconnecting in 10 seconds.
[root@t1 ~]# find / -name mysql.sock
/tmp/mysql.sock
解决:
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
zabbix连不上数据库
[root@localhost etc]# tail -f /var/log/zabbix_server.log
1267:20130722:195451.493 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195451.493 Database is down. Reconnecting in 10 seconds.
1267:20130722:195501.494 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195501.494 Database is down. Reconnecting in 10 seconds.
1267:20130722:195511.494 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195511.494 Database is down. Reconnecting in 10 seconds.
1267:20130722:195521.495 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195521.495 Database is down. Reconnecting in 10 seconds.
1267:20130722:195531.495 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195531.496 Database is down. Reconnecting in 10 seconds.
1267:20130722:195541.496 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195541.496 Database is down. Reconnecting in 10 seconds.
1267:20130722:195551.498 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195551.498 Database is down. Reconnecting in 10 seconds.
解决办法:
[root@localhost lib]# mkdir /var/lib/mysql
[root@localhost lib]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[root@localhost lib]# /etc/rc.d/init.d/mysqld restart
Shutting down MySQL... SUCCESS!
Starting MySQL SUCCESS!