【问题标题】:Connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)连接到数据库 \'zabbix\' 失败:[1045] 用户 \'zabbix\'@\'localhost\' 的访问被拒绝(使用密码:NO)
【发布时间】:2022-11-25 13:24:33
【问题描述】:

我是zabbix的新用户。 更新 zabbix(从 Zabbix 4.0.8 到 Zabbix 4.2.5)后,我遇到了网络界面问题。

The frontend does not match Zabbix database. Current database version (mandatory/optional): 4000000/4000006. Required mandatory version: 4020000. Contact your system administrator.

我打开了一个日志文件,发现:

10344:20221123:151903.222 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 10344:20221123:151903.222 database is down: reconnecting in 10 seconds

我检查了/usr/share/zabbix/conf/zabbix.conf.php

global $DB;

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

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

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix-test';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

如果我使用密码登录 mysql,它就可以工作。

mysql -u zabbix -h localhost --database=zabbix -p

没有密码是行不通的。

mysql -u zabbix -h localhost --database=zabbix
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)

据我了解,问题是zabbix在登录时不使用密码。

我努力了:

mysql> grant all privileges on zabbix.* to zabbix@localhost;

试图更新代理:

apt-get install --only-upgrade zabbix-proxy-mysql

0 upgraded, 0 newly installed, 0 to remove and 109 not upgraded.

【问题讨论】:

    标签: database zabbix


    【解决方案1】:

    zabbix_server.conf 在更新zabbix 后发生了变化。 我发现我的数据库密码被注释掉了。

      DBUser=zabbix
    
    ### Option: DBPassword
    #       Database password.
    #       Comment this line if no password is used.
    #
    # Mandatory: no
    # Default:
    # DBPassword
    

    我写了密码,它有效。

    DBPassword=yourpassword
    

    【讨论】:

      猜你喜欢
      • 2021-10-19
      • 2020-01-16
      • 2021-09-01
      • 2019-12-11
      • 1970-01-01
      • 2018-12-10
      • 1970-01-01
      • 2014-06-06
      • 2013-05-26
      相关资源
      最近更新 更多