自带模板是不能直接建立连接就可以用的

必须经历一下几步:

建立用户权限:

[root@mysql.quan.bbs lib]$mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 105
Server version: 5.7.29-log Source distribution Copyright (c) 2000, 2020, 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> grant all on *.* to zabbix@'localhost' identified by 'zabbix2004';
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

我们先将参数文件复制到安装目录先

源码包复制到安装目录

[root@mysql.quan.bbs zabbix_agentd]$pwd
/data/packages/zabbix-4.4.5/conf/zabbix_agentd
[root@mysql.quan.bbs zabbix_agentd]$cp userparameter_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/

内容为:

#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2
#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default)
#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html
#The file must have three strings:
#[client]
#user=zbx_monitor
#password=<password>
#
UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping
UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version
UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases"
UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
~

修改mysql的配置文件即可:

[root@mysql.quan.bbs zabbix_agentd]$vim /usr/local/mysql/etc/my.cnf 

#[client]
#port = 3306
#socket = /data/mysql/data/mysql.sock
#default-character-set = utf8 [client]
user='zabbix'
password='zabbix2004'
default-character-set=utf8
socket=/data/mysql/data/mysql.sock [mysqladmin]
default-character-set=utf8
socket=/data/mysql/data/mysql.sock
user='zabbix'
password='zabbix2004' [mysql]
default-character-set=utf8
socket=/data/mysql/data/mysql.sock
user='zabbix'
password='zabbix2004'

然后重启mygslq

重启zabbix_agentd

然后就可以了

最新文章

  1. EM界面 ORA-12505: TNS: 监听程序当前无法识别连接描述符中所给出的 SID (DBD ERROR: OCIServerAttach)
  2. apache httpd.conf 参数详解
  3. ABAP 内表的行列转换-发货通知单2
  4. Dynamics AX 从数据库二进制数据导出图片
  5. IOS开发—UIDatePicker 日期/时间选取器(滚轮)
  6. 在oracle中使用Trigger
  7. 【WPF】ContentControl Style定义与使用出现问题后 -- 引发的思考
  8. php集成开发环境的安装以及Zend Studio开发工具的安装
  9. java读取TXT文件的方法
  10. Lucene工作原理
  11. 瞎搞poj1013
  12. 简单的字母全排列问题—递归法和STL法
  13. MVC控制器使用总结
  14. sql server 由于登入失败而无法启动服务
  15. Trove系列(六)——Trove的安全组功能和Trove的卷数据快照功能介绍
  16. Ubuntu18.04 之jdk安装与环境配置
  17. Beta阶段第2周/共2周 Scrum立会报告+燃尽图 14
  18. centos6.9 升级glibc(升级到 2.17版)
  19. jquery each() 方法跳出循环
  20. Python列表操作大全(非常全)

热门文章

  1. JuiceFS 如何帮助趣头条超大规模 HDFS 降负载
  2. [技术博客]大闸蟹的技术博客,通过gitlab api进行用户批量创建
  3. HDMI之TMDS通道
  4. Python爬虫之爬取淘女郎照片示例详解
  5. linux上docker形式部署GB28181服务wvp,zlmedia
  6. 在Ubuntu下安装Solr
  7. 『学了就忘』Linux基础 — 8、虚拟机网络模式说明
  8. 『学了就忘』Linux基础 — 13、Linux系统的分区和格式化
  9. hdu 5178 pairs(BC第一题,,方法不止一种,,我用lower_bound那种。。。)
  10. java 垃圾回收及内存分配策略