[root@gzh-cs8 yum.repos.d]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.35 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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'forhelp. Type '\c' to clear the current input statement.
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; Query OK, 1 row affected (0.00 sec)
mysql> create user zabbix@localhost identified WITH sha256_password BY 'guo123'; Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.05 sec)
mysql> set global log_bin_trust_function_creators = 1; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> delete from user where user=' '; Query OK, 0 rows affected (0.00 sec)
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
4.Zabbix server配置数据库
#导入表完成之后禁用mysql以下功能 [root@gzh-cs8 yum.repos.d]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.35 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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'forhelp. Type '\c' to clear the current input statement.
mysql> set global log_bin_trust_function_creators = 0; Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> quit; Bye # 编辑zabbix_server.conf配置文件 vim /etc/zabbix/zabbix_server.conf
DBPassword=guo123 #DBPassword密码为guo123
2.4启动Zabbix server和agent进程
[root@gzh-cs8 yum.repos.d]# systemctl restart zabbix-server zabbix-agent2 httpd php-fpm [root@gzh-cs8 yum.repos.d]# systemctl enable zabbix-server zabbix-agent2 httpd php-fpm Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service. Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /usr/lib/systemd/system/zabbix-agent2.service. Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
注意!如果报以下错误,修改配置文件
11月 14 06:54:47 gzh-cs8 httpd[29177]: AH00558: httpd: Could not reliably determine the ser... vim /etc/httpd/conf/httpd.conf 找到Servername取消注释并将www.example.com改为localhost