今天不小心在云服务器下载了MySQL8.0,但是因为兼容性,不想使用高版本,于是打算卸载清理干净再重装MySQL57。下面是一些用到的内容:
删除正在占位使用的MySQL8.0以及清理以前mysql内容
rpm -qa | grep -i mysql
rpm -e ??????(可能会清理不掉报错)
清理不掉的情况:RPM: error: db5 error(-30969)
此时该做的:
解决:删除rpm管理数据库,然后重建。步骤如下:
1、cd 到目录“/var/lib/rpm”,确定数据库列表和名称:
root# cd /var/lib/rpm
root# ls -a
2、删除“__db.001”、“__db.002”和“__db.003”:root# rm -rf __db.*
3、重建:root# rpm --rebuilddb
4、这样就可以更新了:root# dnf update
转载原文链接:https://blog.csdn.net/nipseven/article/details/118069230find / -name mysql
# rm -rf ??????(清理掉这些mysql文件)
//创建一个名字为mysql57的文件夹------[root@??? /]# mkdir /mysql57
//进入mysql这个文件夹------[root@??? /]# cd /mysql
//下载yum源------wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'
//安装yum源------rpm -Uvh mysql57-community-release-el7-11.noarch.rpm//查看拥有的mysql------yum repolist all | grep mysql
确认有57版本,继续安装
[root@?????? mysql]# yum install -y mysql-community-server;
首先,此处可能有Error: GPG check FAILED,可以这样yum install -y mysql-community-server --nogpgcheck;其实是跳过检查;然后这个问题解决了,再次安装还有一个问题(Transaction test error: file /etc/my.cnf from install of mysql-community-server-5.7.38-1.el7.x86_64 conflicts with file from package mariadb-connector-c-config-3.1.11-2.1.al8.noarch)
此处其实是包冲突,我们想安装的是前面的包,与后面的包冲突,最快的办法就是删除后面冲突的包
yum list installed
rpm -qa | grep -i mariadb
yum remove [pakeageName]
rpm -qi mysql-community-server
yum install -y mysql-community-server --nogpgcheck 继续下载
Mysql报错:GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
如果是新安装,可能会出现这个问题
需要先安装GPG密钥配置:rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再重新安装mysql-server:yum -y install mysql-server
后面可能因为第一次使用,会有一个系统随机密码
通过grep 'password' /var/log/mysqld.log 查询
然后mysql -uroot -p
Enter password:EE6:ZFs&CB6l
进入MySQL修改密码
如果设置简单密码需要先进行这2行:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
不然就直接
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
修改密码遇到问题:You must reset your password using ALTER USER statement before executing this statement
MySQL版本5.7.6版本以前用户可以使用如下命令:
mysql> SET PASSWORD = PASSWORD('123456');
MySQL版本5.7.6版本开始的用户可以使用如下命令:mysql> ALTER USER USER() IDENTIFIED BY '123456';
转载原文链接:https://blog.csdn.net/muziljx/article/details/81541896Your password does not satisfy the current policy requirements
Your password does not satisfy the current policy requirements
这是由于密码强度问题,一般首次出现这种情况的话可以设置强度较高的密码(带有大、小写英文字母,数字,特殊符号)即可,可降低验证密码策略的安全系数
详细可见:mysql报错 Your password does not satisfy the current policy requirements_Bessssss的博客-CSDN博客
好的,整个流程大部分主要出现问题因为亲身体会已列出并结合大佬们的经验,剩下其他这方面的问题应该问题不大。