[root@host-192-168-5-38 ~]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Sword)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)"
ANSI_COLOR="0;31"
https://downloads.mysql.com/archives/community/
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.3.0-1.el8.x86_64.rpm-bundle.tar
tar -xvf mysql-8.3.0-1.el8.x86_64.rpm-bundle.tar
安装数据库之前,卸载mariadb安装包:
for i in $(rpm -qa | grep mariadb);do rpm -e $i --nodeps; done
安装数据库
rpm -ivh mysql-community-common-8.3.0-1.el8.x86_64.rpm \
mysql-community-client-plugins-8.3.0-1.el8.x86_64.rpm \
mysql-community-libs-8.3.0-1.el8.x86_64.rpm \
mysql-community-client-8.3.0-1.el8.x86_64.rpm \
mysql-community-icu-data-files-8.3.0-1.el8.x86_64.rpm \
mysql-community-server-8.3.0-1.el8.x86_64.rpm \
mysql-community-devel-8.3.0-1.el8.x86_64.rpm
报错信息:
警告:mysql-community-common-8.3.0-1.el8.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID a8d3785c: NOKEY
错误:依赖检测失败:
pkgconfig(openssl) 被 mysql-community-devel-8.3.0-1.el8.x86_64 需要
解决方案:
yum install openssl-devel.x86_64 openssl.x86_64 -y
启动mysql:
systemctl start mysqld; systemctl status mysqld; systemctl enable mysqld
查看数据库密码:
cat /var/log/mysqld.log | grep password
进入成功后 设置自己的密码:
alter user root@localhost identified by 'xxxxxxxx';
修改Mysql连接地址:
use mysql;
update user set host='%' where user = 'root';
commit;
exit;
重启Mysql服务
systemctl restart mysqld
进入数据库查看数据库状态:
[root@host-192-168-5-38 ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.3.0 MySQL Community Server - GPL
Copyright (c) 2000, 2024, 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' for help. Type '\c' to clear the current input statement.
mysql>
mysql>
mysql> status;
--------------
mysql Ver 8.3.0 for Linux on x86_64 (MySQL Community Server - GPL)
Connection id: 8
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.3.0 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /var/lib/mysql/mysql.sock
Binary data as: Hexadecimal
Uptime: 41 sec
Threads: 2 Questions: 6 Slow queries: 0 Opens: 119 Flush tables: 3 Open tables: 38 Queries per second avg: 0.146
--------------
mysql>
麒麟系统同源构建,使用高于CentOS7版本,如使用:
1 安装zabbix库文件
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
# dnf clean all
2 安装Zabbix服务器,前端,代理
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
3 创建初始数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
4 在Zabbix服务器上,主机导入初始模式和数据
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
5 在导入数据库模式后,禁用函数_log_bin_trust_function_creators。
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
6 修改配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
7 为Zabbix前端配置PHP
编辑文件 /etc/nginx/conf.d/zabbix.conf 取消注释并设置“侦听”和“server_name”指令。
# listen 80;
# server_name example.com;
8 添加时区 /etc/php-fpm.d/zabbix.conf
; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = Asia/Shanghai
9 启动服务
# systemctl restart zabbix-server zabbix-agent nginx php-fpm
# systemctl enable zabbix-server zabbix-agent nginx php-fpm
报错信息:
40432:20240507:104906.600 using configuration file: /etc/zabbix/zabbix_server.conf
40432:20240507:104906.603 [Z3001] connection to database 'zabbix' failed: [2059] Plugin caching_sha2_password could not be loaded: lib64/mariadb/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
原因分析:
无法加载身份验证插件,身份验证插件找不到,MySql 8.0.32 换了新的身份验证插件(caching_sha2_password);之前的身份验证插件为(mysql_native_password)。zabbix找不到换了之后的验证插件身份。
可以尝试将mysql用户使用的登录密码加密规则 还原成 mysql_native_password。
解决方法:
mysql> use mysql;
mysql> select user,host,plugin,authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user | host | plugin | authentication_string |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root | % | caching_sha2_password | $A$005$|r:B^al{O=V?>.HDUVgbUQka/TW8qYIQG3GIKpt24aLsXOL6g5Cpl2bZ3 |
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| zabbix | localhost | caching_sha2_password | $A$005$
".
c
QDf(>{y&[dp7sIVoQPMfsg//6oEZzM5A.tnKmR8MHRScXsSCj4wD |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
mysql> alter user 'zabbix'@'localhost' identified with mysql_native_password by 'XXXXXXXX';
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,plugin,authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user | host | plugin | authentication_string |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root | % | caching_sha2_password | $A$005$|r:B^al{O=V?>.HDUVgbUQka/TW8qYIQG3GIKpt24aLsXOL6g5Cpl2bZ3 |
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| zabbix | localhost | mysql_native_password | *271B3DEFA37AB17977C2AF4B7176FAFE478EA142 |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
[root@host-192-168-5-38 ~]# find / -name fonts
/usr/share/zabbix/assets/fonts
[root@host-192-168-5-38 ~]# cd /usr/share/zabbix/assets/fonts/
[root@host-192-168-5-38 fonts]# ll
总用量 0
lrwxrwxrwx 1 root root 33 5月 7 10:40 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@host-192-168-5-38 fonts]# 上传需要使用字体
rz waiting to receive.
[root@host-192-168-5-38 fonts]# ls
graphfont.ttf SIMSUN.TTC
[root@host-192-168-5-38 fonts]# mv graphfont.ttf graphfont.ttf.bak
[root@host-192-168-5-38 fonts]# mv SIMSUN.TTC graphfont.ttf
[root@host-192-168-5-38 fonts]# systemctl restart zabbix-server.service
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。