版本mysql 5.7
新建文件夹/data/download
进入后下载
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
安装
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022(这里要用2022)
yum install mysql-server
systemctl start mysqld
systemctl enable mysqld (开机启动)
获取临时密码
grep 'temporary password' /var/log/mysqld.log
把MySQL的密码校验强度改为低风险
set global validate_password_policy=LOW;
修改MySQL的密码长度为6位
set global validate_password_length=6;
修改MySQL密码为123456
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
查看防火墙状态,如果开启则把防火墙给关闭
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld (取消开机启动)
# 连接数据库
mysql -uroot -p
# 切换到mysql表
use mysql;
# 查看root的host权限
select host from user where user='root';
# 修改登录权限
update user set host = '%' where user ='root';
# 刷新
flush privileges;
# 再次查看权限
select host from user where user='root';
标签:rpm,lnmp,host,systemctl,user,第五步,mysql,root From: https://www.cnblogs.com/hlgg/p/17934343.html