在安装的Mysql 8+版本后远程连接不上
注意:每次修改后,涉及到权限的一定要刷新权限。
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.04 sec)
mysql>
会报一个错误:
1130 - Host '10.45.12.79' is not allowed to connect to this MySQL server
一、查看Mysql是否开启可以远程访问的权限
1.登录mysql机器
mysql -u root -p
2.切换到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>
3.查看是否运行远程访问
可以看到第一行root 用户的host为localhost,要远程访问,需要将它改成%
mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root