[root@gree135 ~]# cd /etc/sysconfig/network-scripts/
[root@gree135 network-scripts]# vi ./ifcfg-ens33
BOOTPROTO=static
IPADDR=192.168.153.135
GATEWAY=192.168.153.2
NETMASK=255.255.255.0
DNS1=8.8.8.8
[root@gree135 ~]# systemctl restart network.service
[root@gree135 ~]# yum install -y wget
[root@gree135 ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
[root@gree135 ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm
[root@gree135 ~]# yum install mysql-community-server
[root@gree135 ~]# systemctl start mysqld
[root@gree135 ~]# systemctl enable mysqld
[root@gree135 ~]# systemctl daemon-reload
[root@gree135 ~]# systemctl stop firewalld
[root@gree135 ~]# systemctl disable firewalld
[root@gree135 ~]# grep 'temporary password' /var/log/mysqld.log
2021-10-08T03:21:28.093080Z 1 [Note] A temporary password is generated for root@localhost: 2qdMM&vmgRTB
[root@gree135 ~]# mysql -uroot -p
Enter password:
#设置密码报错,密码不符合安全等级
mysql> alter user 'root'@'localhost' identified by 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
#设置mysql密码安全等级
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
#重新设置密码成功
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.00 sec)
# exit退出重新登陆,使用新密码
#设置远程登陆
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)