当前位置:首页 » Mysql技术教程

mysql8.0.11安装和远程连接配置

2018-05-03 16:21 本站整理 浏览(235)

mysql 8.0.11 解压版 

mysql> alter  user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.21 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)

--远程客户端连接
mysql> update user set Host='%' where User='root';
Query OK, 1 row affected (0.16 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)

--客户端远程连接时报:Plugin caching_sha2_password could not be loaded,客户端不支持该加密方式
mysql> select user, host, plugin, authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user             | host      | plugin                | authentication_string                                                  |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root             | %         | caching_sha2_password | $A$005$%z/Joxf//e8}+nUO01.YASUzG9p3CRWbrp5nz/u8O4gy/aEEnV8xqPIDD |
| mysql.infoschema | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE                              |
| mysql.session    | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE                              |
| mysql.sys        | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE                              |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
4 rows in set (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.10 sec)

--重新修改密码后可连接成功
mysql> alter  user 'root'@'%' identified by '123456';
Query OK, 0 rows affected (0.23 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)

--重新使用工具登录即可 本文使用工具是:SQLyog 12.5.0