Zabbix 连接 MySQL 错误

Zabbix 连接 MySQL 错误

尝试打开 Zabbix 2.2.2 服务器 Web 界面时出现错误:

Database error: Error connecting to database [Access denied for user 'zabbix'@'localhost' (using password: YES)]

这是日志:

870:20140716:181121.327 Starting Zabbix Server. Zabbix 2.2.2 (revision 42525).
   870:20140716:181121.327 ****** Enabled features ******
   870:20140716:181121.328 SNMP monitoring:           YES
   870:20140716:181121.328 IPMI monitoring:            NO
   870:20140716:181121.328 WEB monitoring:            YES
   870:20140716:181121.329 VMware monitoring:          NO
   870:20140716:181121.329 Jabber notifications:      YES
   870:20140716:181121.329 Ez Texting notifications:  YES
   870:20140716:181121.329 ODBC:                       NO
   870:20140716:181121.329 SSH2 support:               NO
   870:20140716:181121.330 IPv6 support:              YES
   870:20140716:181121.330 ******************************
   870:20140716:181121.330 using configuration file: /usr/local/etc/zabbix22/zabbix_server.conf
   870:20140716:181121.335 current database version (mandatory/optional): 02020000/02020000
   870:20140716:181121.335 required mandatory version: 02020000
   871:20140716:181121.345 server #1 started [configuration syncer #1]
   872:20140716:181121.346 server #2 started [db watchdog #1]
   870:20140716:181121.395 server #0 started [main process]
   873:20140716:181121.424 server #3 started [poller #1]
   874:20140716:181121.452 server #4 started [poller #2]
   875:20140716:181121.479 server #5 started [poller #3]
   876:20140716:181121.509 server #6 started [poller #4]
   877:20140716:181121.535 server #7 started [poller #5]
   878:20140716:181121.564 server #8 started [unreachable poller #1]

没有关于连接错误的消息。这是配置文件:

### Option: DBHost
#       Database host name.
#       If set to localhost, socket is used for MySQL.
#       If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
DBHost=localhost

### Option: DBName
#       Database name.
#       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
#
# Mandatory: yes
# Default:
# DBName=

DBName=zabbix
### Option: DBSchema
#       Schema name. Used for IBM DB2.
#
# Mandatory: no
# Default:
# DBSchema=

### Option: DBUser
#       Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=

DBUser=zabbix

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

### Option: DBSocket
#       Path to MySQL socket.
#
# Mandatory: no
# Default:
#DBSocket=/tmp/mysql.sock
### Option: DBPort
#       Database port when not using local socket. Ignored for SQLite.
#
# Mandatory: no
# Range: 1024-65535
# Default (for MySQL):
# DBPort=3306

我可以使用该用户名和密码从 shell 连接:

root@zabbix-srv:/usr/home/ishayahu # mysql -u zabbix -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 167
Server version: 5.5.37 Source distribution

Copyright (c) 2000, 2014, 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> show grants for 'zabbix'@'localhost';
+------------------------------------------------------------------------------------------------------------------------+
| Grants for zabbix@localhost                                                                                            |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY PASSWORD '*DEEF4D7D88CD046ECA02A80393B7780A63E7E789' |
| GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'localhost'                                                             |
+------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

谢谢你的帮助!

答案1

您已在此处粘贴服务器配置文件 - 前端使用不同的文件。请查看前端目录中的 zabbix.conf.php 文件,并确保其中的密码与服务器配置文件中的密码匹配。

相关内容