【麒麟部署】麒麟Kylin_x86_hygon关于MySQL数据库安装保姆级教程

发布时间:2024年01月19日

服务器系统/版本号/CPU查询

uname -a

[root@YCSPJ-GG-kz-3 mysql_data]# uname -a
Linux YCSPJ-GG-kz-3 4.19.90-24.4.v2101.ky10.x86_64 #1 SMP Mon May 24 12:14:55 CST 2021 x86_64 x86_64 x86_64 GNU/Linux

lscpu

[root@YCSPJ-GG-kz-3 mysql_data]# lscpu
架构:                           x86_64
CPU 运行模式:                   32-bit, 64-bit
字节序:                         Little Endian
Address sizes:                   48 bits physical, 48 bits virtual
CPU:                             4
在线 CPU 列表:                  0-3
每个核的线程数:                 1
每个座的核数:                   4
座:                             1
NUMA 节点:                      1
厂商 ID:                        AuthenticAMD
CPU 系列:                       15
型号:                           6
型号名称:                       Hygon C86 7360 24-core Processor
步进:                           3
CPU MHz:                        2200.000
BogoMIPS:                       4400.00
超管理器厂商:                   KVM
虚拟化类型:                     完全
L1d 缓存:                       256 KiB
L1i 缓存:                       256 KiB
L2 缓存:                        2 MiB
L3 缓存:                        16 MiB
NUMA 节点0 CPU:                 0-3
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full AMD retpoline, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
标记:                           fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 x2apic aes hypervisor cmp_legacy 3dnowpre
                                 fetch vmmcall

麒麟系统版本依赖库

https://archive.kylinos.cn/yum/v10/sp1-openstack-q/x86_64/

下载mysql版本

mysql-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 12279204
mysql-common-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 27168
mysql-config-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 7356
mysql-debugsource-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 15705308
mysql-devel-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 82820
mysql-errmsg-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 507300
mysql-help-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 248684
mysql-libs-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 1197752
mysql-server-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 28386664
mysql-test-8.0.18-2.ky10.x86_64.rpm 10-Jul-2020 09:21 142399392

在这里插入图片描述

安装过程

1、卸载mariadb

rpm -qa | grep mariadb
rpm -e --nodeps mariadb-errmessage-10.3.9-9.p02.ky10.x86_64
rpm -e --nodeps mariadb-XXXXXX-10.3.9-9.p02.ky10.x86_64
rpm -e --nodeps mariadb-XXXXXX-10.3.9-9.p02.ky10.x86_64

2、卸载mysql

rpm -qa | grep mysql
rpm -e --nodeps mysql-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3、安装mysql

rpm -qa | grep mysql
依次安装
rpm -ivh mysql-config-8.0.18-2.ky10.x86_64.rpm
ln -sf /usr/lib64/libLLVM-7.0.0.so /usr/lib64/libLLVM-7.so
rpm -ivh mysql-common-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-libs-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-devel-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-errmsg-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-debugsource-8.0.18-2.ky10.x86_64.rpm
rpm -ivh mysql-help-8.0.18-2.ky10.x86_64.rpm
rpm -ivh protobuf-3.9.0-9.ky10.x86_64.rpm
rpm -ivh protobuf-lite-3.9.0-9.ky10.x86_64.rpm
rpm -ivh mysql-server-8.0.18-2.ky10.x86_64.rpm

4、初始化mysql

chown -R mysql:mysql /var/lib/mysql/ 设置权限,权限不对会导致服务启动失败
systemctl start mysqld.service 启动服务
systemctl status mysqld.service 服务状态查询
cat /var/log/mysql/mysqld.log | grep password 查看初始密码
mysql -u root -p 登录mysql

5、配置数据库data目录

systemctl stop mysqld.service 停止服务
mkdir /data/database #创建目录
sudo cp -rp /var/lib/mysql /data/database #复制数据到新建目录,注意会自动在database中建mysql目录
sudo chown -R mysql:mysql /data/database/mysql 设置权限,权限不对会导致服务启动失败

修改配置文件
在这里插入图片描述

systemctl start mysqld.service 启动服务
systemctl status mysqld.service 服务状态查询

附:nginx流代理配置,可以将内网数据库,通过公网服务器代理出去供访问

在这里插入图片描述

文章来源:https://blog.csdn.net/qq_20410657/article/details/135701605
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。