OS: RHEL 8.5
mysql version : 8.0.26
Zabbix version : 5.0
Problem : Cannot connect to the database
Jan 27 14:00:23 zabbix zabbix_server[26357]: Got signal [signal:15(SIGTERM),sender_pid:26520,sender_uid:0,reason:0]. Exiting ...
Jan 27 14:00:23 zabbix zabbix_server[26377]: syncing history data in progress...
Jan 27 14:00:23 zabbix zabbix_server[26377]: syncing history data done
Jan 27 14:00:23 zabbix zabbix_server[26397]: [Z3005] query failed: [2006] MySQL server has gone away [select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,e.source,e.object,e.objectid,a.parameters,a.eventid,a.p_eventid from alerts a left join events e on a.eventid=e.eventid where alerttype=0 and a.status=3 order by a.alertid]
Jan 27 14:00:23 zabbix zabbix_server[26397]: [Z3001] connection to database 'zabbix-server' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jan 27 14:00:23 zabbix zabbix_server[26397]: database is down: reconnecting in 10 seconds
Jan 27 14:00:23 zabbix zabbix_server[26357]: [Z3001] connection to database 'zabbix-server' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jan 27 14:00:23 zabbix zabbix_server[26357]: Cannot connect to the database. Exiting...
Jan 27 14:00:30 zabbix systemd[1]: zabbix-server.service: Can't open PID file /run/zabbix/zabbix_server.pid (yet?) after start: No such file or directory
When i try to execute the command manually
mysql -u zabbix-server -p zabbix-server -S /var/lib/mysql/mysql.sock
It work without problem...
This is my /etc/my.cnf
##
# Ansible managed
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#bind-address=0.0.0.0
bind-address=localhost
max_allowed_packet=64M
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 2802M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
I tried every possible solution but nothing seems to work for me:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)