暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

配置SQLDeveloper连接mysql时报错Message from server:”host ‘****’ is not allowed to connect to this mysql server”

原创 Leo 2023-06-09
428

问题描述:配置SQLDeveloper连接mysql时报错Message from server:”host ‘****’ is not allowed to connect to this mysql server”,如下所示:

数据库:mysql 8.0.27

SQL Developer版本:23.1.0.097

连接mysql使用的驱动文件:mysql-connector-j-8.0.33.jar

1、异常重现


2、解决过程

[root@leo-mysql ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 8.0.11 MySQL Community Server - GPL

 

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

 

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> 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> select host,user from user;

+-----------+------------------+

| host      | user             |

+-----------+------------------+

| leo-mysql | alina            |

| localhost | mysql.infoschema |

| localhost | mysql.session    |

| localhost | mysql.sys        |

| localhost | root             |

| localhost | testuser         |

+-----------+------------------+

6 rows in set (0.00 sec)

 

mysql> update user set host='%' where user='root';

Query OK, 1 row affected (0.03 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

mysql> select host,user from user;

+-----------+------------------+

| host      | user             |

+-----------+------------------+

| %         | root             |

| leo-mysql | alina            |

| localhost | mysql.infoschema |

| localhost | mysql.session    |

| localhost | mysql.sys        |

| localhost | testuser         |

+-----------+------------------+

6 rows in set (0.00 sec)

 

mysql> grant all on *.* to 'root'@'%';

Query OK, 0 rows affected (0.07 sec)

3、连接验证



说明:如上所示,sql developer成功连接mysql数据库.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论