1、mysql8完全卸载
sudo systemctl stop mysqld
sudo yum remove mysql-community-server
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/my.cnf
sudo groupdel mysql
sudo userdel mysql
sudo rm -rf /var/log/mysql
sudo rm -rf /tmp/mysql.sock
sudo find / -name 'mysql*' -exec rm -rf {} \;
2、mysql8安装
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo yum clean all
sudo yum makecache
sudo yum install mysql-community-server
sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';
FLUSH PRIVILEGES;
-----------------------------------------------------------------------------------------
源 “MySQL 8.0 Community Server” 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
失败的软件包是:mysql-community-server-8.0.31-1.el7.x86_64 GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
sudo yum install mysql-server --nogpgcheck
————————————————
原文链接:https://blog.csdn.net/a_cherry_blossoms/article/details/137642187