免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 39643 | 回复: 2
打印 上一主题 下一主题

[Zabbix] zabbix连接不上mysql [复制链接]

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-08-05 06:20:00数据库技术版块每日发帖之星
日期:2015-08-23 06:20:00数据库技术版块每日发帖之星
日期:2016-04-19 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-05-17 18:17 |显示全部楼层 |倒序浏览
  8705:20160517:181535.420 [Z3001] connection to database 'zabbix' failed: [2003] Can't connect to MySQL server on 'host' (13)
  8705:20160517:181535.420 database is down: reconnecting in 10 seconds

数据库和ZABBIX在同一台服务器上。

# cat /etc/hosts
127.0.0.1  host
192.168.8.120 host


# grep -v "#" /etc/zabbix/zabbix_server.conf|grep DB
DBHost=host
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'host';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'Zabbix;

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';

$ZBX_SERVER      = '192.168.8.120';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'host';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;


手工连接没有问题。

# mysql -u zabbix -p'zabbix'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.12 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-08-05 06:20:00数据库技术版块每日发帖之星
日期:2015-08-23 06:20:00数据库技术版块每日发帖之星
日期:2016-04-19 06:20:00
2 [报告]
发表于 2016-06-14 16:59 |显示全部楼层
本帖最后由 oushitianxia915 于 2016-06-14 17:00 编辑

回复 6# h101com

权限是有的啊,另外跟端口没关系,是0 的时候我也启过ZABBIX

show grants for zabbix@host;
+---------------------------------------------------------------------+
| Grants for zabbix@host                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'host' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
   

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-08-05 06:20:00数据库技术版块每日发帖之星
日期:2015-08-23 06:20:00数据库技术版块每日发帖之星
日期:2016-04-19 06:20:00
3 [报告]
发表于 2016-06-14 17:02 |显示全部楼层
回复 2# expert1

1005是ZABBIX的服务端口


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP