zabbix 搭建 mysql 连接报错

如图所示:

查看 MySQL的配置文件

[root@zbxtest ~]# cat /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[client]
socket=/data/mysql/mysql.sock
[root@zbxtest ~]# ps -ef |grep mysql 
mysql     10339      1  0 13:27 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql     10500  10339  0 13:27 ?        00:00:01 /usr/libexec/mysqld --basedir=/usr --datadir=/data/mysq --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/data/mysql/mysql.sock
root      11548  10030  0 13:37 pts/0    00:00:00 grep --color=auto mysql

socket 配置 与 zabbix web 不相符 ,需要修改 my.cnf 文件内容,把socket修改成与那个zabbix web 截图一样就可以了

1 [root@zbxtest my.cnf.d]# egrep -v "^#|^$" /etc/my.cnf
2 [mysqld]
3 datadir=/data/mysql
4 socket=/var/lib/mysql/mysql.sock
5 symbolic-links=0
6 [mysqld_safe]
7 log-error=/var/log/mariadb/mariadb.log
8 pid-file=/var/run/mariadb/mariadb.pid
9 !includedir /etc/my.cnf.d

 

posted on 2019-08-16 13:54  Z_m  阅读(787)  评论(0编辑  收藏

导航