CentOS7安装MySQL8
1、配置Mysql8安装源:
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
2、安装MySQL8服务
sudo yum --enablerepo=mysql80-community install mysql-community-server
3、启动mysql服务
sudo service mysqld start
4、查看mysql服务运行状态
service mysqld status
5、查看root临时密码
grep "A temporary password" /var/log/mysqld.log
root@localhost: &.+tkOufI6dM
6、更改临时密码
mysql -uroot -p
在Enter password:后面输入临时密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '!QAZ2wsx';
7、当前的密码验证策略
SHOW VARIABLES LIKE 'validate_password.%';
8、配置远程访问
创建账号:
create user 'root'@'%' identified by '1qaz@WSX';
授予访问权限:
grant all privileges on *.* to 'root'@'%' with grant option;
刷新数据块:
FLUSH PRIVILEGES;
9、防火墙:
查看:
systemctl status firewalld.service
关闭:
systemctl stop firewalld service
启动:
systemctl start firewalld service
开机禁止防火墙:
systemctl disable firewalld.service
开机启动防火墙:
systemctl enable firewalld.service