安装mysql-8.0.13-1.el7.x86_64.rpm-bundle

1. 安装

mkdir mysql-8.0.13-1.el7.x86_64.rpm-bundle && cd mysql-8.0.13-1.el7.x86_64.rpm-bundle
tar ../xvf mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar
mv mysql-community-test-8.0.13-1.el7.x86_64.rpm ..
rpm -ivh *.rpm
#rpm -ivh *.rpm  --force --nodeps         #出现错误命令加 --force --nodeps

2. 配置

firewall-cmd --zone=public --add-port=3306/tcp --permanent   #打开3306端口
mysqld --initialize --user=mysql
systemctl start mysqld                    #启动
systemctl status mysqld                   #查看状态
cat /var/log/mysqld.log | grep password   #查看初始密码
mysql -uroot -p

#修改密码策略
mysql> set global validate_password.length=4;
mysql> set global validate_password.policy=0;
mysql> SHOW VARIABLES LIKE 'validate_password%';    #查看密码策略
mysql> ALTER USER root@localhost identified by '(新密码)' password expire never; 

你可能感兴趣的:(环境搭建)