问题描述:配置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、异常重现

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

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、连接验证

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

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

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