麒麟V10安装MySQL8.4

1、下载安装包

wget https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.5-1.el7.x86_64.rpm-bundle.tar

2、解压

mkdir -p /opt/mysql
tar -xvf mysql-8.4.5-1.el7.x86_64.rpm-bundle.tar -C /opt/mysql

3、安装MySQL

3.1、卸载mariadb

rpm -qa | grep mariadb
rpm -e mariadb-connector-c-3.0.6-9.ky10.x86_64 --nodeps
rpm -qa | grep mariadb

3.2、安装依赖

https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/base/x86_64/Packages/compat-openssl10-1.0.2o-8.ky10.x86_64.rpm

rpm -ivh compat-openssl10-1.0.2o-8.ky10.x86_64.rpm --nodeps

3.3、安装MySQL

rpm -ivh mysql-community-common-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.4.5-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.4.5-1.el7.x86_64.rpm

3.4、修改配置

vi /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.4/en/server-configuration-defaults.html

[mysqld]
# 设置3306端口
port=3306
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

datadir=/data/mysql/data
socket=/data/mysql/data/mysql.sock

log-error=/data/mysql/log/mysqld.log
pid-file=/data/mysql/mysqld/mysqld.pid

# 表,列名大小写不敏感,0为区分大小写
lower_case_table_names=1
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4

[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
socket=/data/mysql/data/mysql.sock
default-character-set=utf8mb4

3.5、初始化MySQL

mkdir -p /data/mysql/{data,log,mysqld}
chown -R mysql:mysql /data/mysql/

mysqld --initialize --user=mysql --lower-case-table-names=1

systemctl enable mysqld --now

# 查看是否开机自启
systemctl is-enabled mysqld.service

3.6、设置远程登陆

grep 'temporary password' /data/mysql/log/mysqld.log
# 修改密码
alter user 'root'@'localhost' identified by 'kylin#2025';

# 刷新配置
flush privileges;

# 配置远程登陆
CREATE USER 'root'@'%' IDENTIFIED  BY 'kylin#2025';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

flush privileges;

select user,host,authentication_string  from mysql.user where user='root';

# 查看字符集
show variables like 'character_set_%';

4、卸载MySQL

4.1、取消MySQL自启动

systemctl disable mysqld

4.2、查看安装的MySQL

rpm -qa | grep -i mysql
OR
yum list install mysql*

4.3、卸载MySQL

yum -y remove mysql-community-libs-compat-8.4.5-1.el7.x86_64
yum -y remove mysql-community-common-8.4.5-1.el7.x86_64
yum -y remove mysql-community-libs-8.4.5-1.el7.x86_64
yum -y remove mysql-community-icu-data-files-8.4.5-1.el7.x86_64
yum -y remove mysql-community-client-8.4.5-1.el7.x86_64
yum -y remove mysql-community-server-8.4.5-1.el7.x86_64
yum -y remove mysql-community-client-plugins-8.4.5-1.el7.x86_64

4.4、查询MySQL安装目录

whereis mysql
find / -name mysql
find / -name '*mysql*'

4.5、删除查询出的目录

rm -rf /var/lib/selinux/targeted/tmp/modules/100/mysql
rm -rf /usr/lib64/mysql
rm -rf /data/mysql

rm -rf /root/.mysql_sercret  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值