当前位置: 代码迷 >> 综合 >> 【数据库】Mysql 8 1130, “Host ‘xxxx‘ is not allowed to connect to this MySQL server“
  详细解决方案

【数据库】Mysql 8 1130, “Host ‘xxxx‘ is not allowed to connect to this MySQL server“

热度:20   发布时间:2024-02-09 02:20:35.0

【数据库】Mysql 8 1130, "Host 'xxxx' is not allowed to connect to this MySQL server"

 

 

mysql> use mysql;
mysql> select host,user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
4 rows in set (0.00 sec)
mysql>

 

授权访问,因为是本地连接,所以,给予了所有权限

mysql> grant all privileges on *.* to 'root'@'%' with grant option;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

产生用户不能授权的原因是mysql 数据库中user 表中的特定用户(root) 的host 的属性值为localhost

 

 

 

mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> grant all privileges on *.* to 'root'@'%';
Query OK, 0 rows affected (0.01 sec)//刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 

 

 

 

 

 

 

 

 

 

 

 

  相关解决方案