[root@VM-16-15-centos server]# wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
--2021-12-10 15:13:14-- https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
2021-12-10 15:13:16 (201 MB/s) - 已保存 “mysql80-community-release-el8-1.noarch.rpm” [30388/30388])
[root@VM-16-15-centos server]# rpm -ivh mysql80-community-release-el8-1.noarch.rpm
警告:mysql80-community-release-el8-1.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:mysql80-community-release-el8-1 ################################# [100%]
[root@VM-16-15-centos server]# md5sum mysql80-community-release-el8-1.noarch.rpm
7166fed89332ab92fb3ec666e95d6ad1 mysql80-community-release-el8-1.noarch.rpm
[root@VM-16-15-centos server]# yum install mysql-server
MySQL 8.0 Community Server 713 kB/s | 2.1 MB 00:03
完毕!
[root@VM-16-15-centos server]# systemctl list-unit-files|grep mysqld
mysqld.service disabled
mysqld@.service disabled
[root@VM-16-15-centos server]# systemctl enable mysqld.service
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@VM-16-15-centos server]# systemctl list-unit-files|grep mysqld
mysqld.service enabled
mysqld@.service disabled
[root@VM-16-15-centos server]# ps -ef|grep mysql
root 154955 1947 0 15:23 pts/0 00:00:00 grep --color=auto mysql
[root@VM-16-15-centos server]# systemctl start mysqld.service
[root@VM-16-15-centos server]#
[root@VM-16-15-centos server]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.26 Source distribution
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
mysql> update user set host='%' where user ='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root1234';
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
sqlyog远程链接效果如下:↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓