使用的參考鏈接:
https://blog.csdn.net/whjcsdnwhj/article/details/81940826
https://blog.csdn.net/rujianxuezha/article/details/79842998
本地基本信息:
➜ ~ php --version
PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
➜ ~ mysql --version
mysql Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)
➜ ~ uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
錯誤1:安裝完之後進入 zabbix 的 setup 界面出現幾個fail
解決:修改如下
/etc/php.ini
post_max_size =16M
max_execution_time =300
max_input_time =300
date.timezone = PRC
post_max_size = 32M
錯誤二:在 setup 界面第三步 “Configure DB connection” ,出現 Error setting auto commit, 檢查源代碼如下
$DB['DB'] = @mysqli_connect($DB['SERVER'], $DB['USER'], $DB['PASSWORD'], $DB['DATABASE'], $DB['PORT']);
if (!$DB['DB']) {
$error = 'Error connecting to database: '.trim(mysqli_connect_error());
$result = false;
}
elseif (mysqli_autocommit($DB['DB'], true) === false) {
$error = 'Error setting auto commit.';
$result = false;
}
else {
DBexecute('SET NAMES utf8');
}
解決:修改 /etc/my.cnf, 在 [mysqld] 下邊取消註釋或者添加如下一行
default_authentication_plugin= mysql_native_password
錯誤三: 日誌裏邊出現如下內容
connection to database 'zabbix' failed: [0] could not connect to server: Connection refused
Is the server running on host "192.168.72.128" and accepting
TCP/IP connections on port 5432?
解決過程如下
使用 rpm -qa |grep -i zabbix 查看是否安裝了 zabbix-server-pgsql ,然後刪除 zabbix-server-pgsql,因爲這裏我們用的是 mysql
問題四: connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
解決:
手動設置 my.cnf 的 socket 參數