Java::JavaSql::SQLException: null, message from server: "Host 'alex' is not allowed to connect to this MySQL server"
2058 com.mysql.jdbc.SQLError.createSQLException(com/mysql/jdbc/SQLError.java:965)
2058 com.mysql.jdbc.SQLError.createSQLException(com/mysql/jdbc/SQLError.java:898)
2058 com.mysql.jdbc.SQLError.createSQLException(com/mysql/jdbc/SQLError.java:887)
2058 com.mysql.jdbc.MysqlIO.doHandshake(com/mysql/jdbc/MysqlIO.java:1038)
因为es数据库部署在远端,mysql在本机
原因是是本机电脑mysql没有开放远端连接权限,需要修改mysql权限
mysql -uroot -proot
use mysql
select user, host from user;
update user set host = '%' where user = 'root';
select user, host from user;
flush privileges;

解决
本文讲述了如何解决Java应用程序在尝试从本地连接到远程部署的MySQL服务器时遇到的权限问题,涉及到了SQL异常和MySQL权限设置的步骤,包括检查并修改root用户的主机权限。
2257

被折叠的 条评论
为什么被折叠?



