wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
yum localinstall mysql80-community-release-el7-3.noarch.rpm
yum -y install mysql-community-server
mysql-community-server-8.0.31-1.el7.x86_64.rpm 的公钥尚未安装
官方的解决方法:点击跳转
推荐直接尝试该命令
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
Error: Unable to find a match: mysql-community-server
解决方法–先执行:
yum module disable mysql
再执行:
yum -y install mysql-community-server
yum -y install mysql-community-server
systemctl start mysqld.service
systemctl status mysqld.service
grep "password" /var/log/mysqld.log
mysql -u root -p
可以先改为该密码,随后再调整密码策略后修改成简单密码。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!@#';
SHOW VARIABLES LIKE 'validate_password%';
validate_password.length 是密码的最小长度,默认是8,我们把它改成6
输入:
set global validate_password.length=4;
validate_password.policy 验证密码的复杂程度,我们把它改成0
输入:
set global validate_password.policy=0;
validate_password.check_user_name 用户名检查,用户名和密码不能相同,我们也把它关掉
输入:
set global validate_password.check_user_name=off;
yum -y remove mysql80-community-release-el7-3.noarch
systemctl stop mysqld.service #关闭mysql
service mysqld restart #重启mysql
????DNF包管理器克服了YUM包管理器的一些瓶颈,提升了包括用户体验,内存占用,依赖分析,运行速度等多方面的内容。DNF使用 RPM, libsolv 和 hawkey 库进行包管理操作。
yum install dnf
sudo dnf install @mysql
sudo systemctl enable --now mysqld
查看MySQL状态
sudo systemctl status mysqld
sudo grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
使用ALTER重置root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Gvssimux...1';