添加规则
[root@VM-4-8-centos ~]# cd /usr/local/src/
[root@VM-4-8-centos src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
[root@VM-4-8-centos src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
警告:mysql57-community-release-el7-8.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
[root@VM-4-8-centos src]# yum -y install mysql-server
失败的软件包是:mysql-community-client-5.7.39-1.el7.x86_64
GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[root@VM-4-8-centos src]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@VM-4-8-centos src]# yum -y install mysql-community-server
[root@VM-4-8-centos src]# systemctl start mysqld.service
[root@VM-4-8-centos src]# grep "password" /var/log/mysqld.log
[root@VM-4-8-centos src]# mysql -u root -p
Enter password:
mysql> alter user 'root'@'localhost' identified by 'Hh123456';
Query OK, 0 rows affected (0.00 sec)
mysql> create user 'root'@'%' identified by 'Hh123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@VM-4-8-centos src]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@VM-4-8-centos src]# firewall-cmd --list-port
20/tcp 21/tcp 22/tcp 80/tcp 443/tcp 8888/tcp 39000-40000/tcp
[root@VM-4-8-centos src]# firewall-cmd --reload
success
[root@VM-4-8-centos src]# firewall-cmd --list-port
20/tcp 21/tcp 22/tcp 80/tcp 443/tcp 8888/tcp 39000-40000/tcp 3306/tcp