1.配置Mysql 8.0安装源:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql-community-server
2.安装Mysql 8.0
yum --enablerepo=mysql80-community install mysql-community-server -y
3.启动mysql服务
安装完的第一件事当然是启动mysql服务啦
service mysqld start
4.
mysql_secure_installation #修改Mysql密码,输入之前生成的密CSJlm3DyTG.d回车,根据提示操作。
Press y|Y for Yes, any other key for No: y #是否安装密码安全插件?选择y
There are three levels of password validation policy: #有以下几种密码强度选择
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 #选择0,只要8位数字即可,选1要有大写,小写,特殊字符等
UNINSTALL PLUGIN validate_password ; #卸载密码强度插件
use mysql;
update mysql.user set authentication_string=password('123456') where user='root' ; #登录mysql控制台修改
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password AS '123456'; #修改密码