1.1 检测与卸载已安装版本
rpm -qa|grep -i mysql
rpm -ev mysql-community-client-8.0.11-1.el7.x86_64 --nodeps
find / -name mysql
rm -rf /var/lib/mysql/
1.2 开始安装新版本
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo yum --enablerepo=mysql80-community install mysql-community-server
grep "A temporary password" /var/log/mysqld.log;
XXX
ALTER USER 'root'@'localhost' IDENTIFIED BY 'XX';
CREATE USER 'root'@'%' IDENTIFIED BY 'XXXX';
flush privileges;
1.3 创建所需数据库
create database chemex character set utf8mb4 collate utf8mb4_bin;
说明:
1.XX为密码
2.若出现密钥问题,请执行以下代码更新密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 /导入新密钥
yum -y install mysql-server /重新执行安装
3.若2还是不行,需要修改源
cd vim /etc/yum.repos.d/mysql-community.repo
#选择对应版本
gpgcheck=1 改为gpgcheck=0 即可