使用Dbeaver连接远端数据库报错:java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to c
报错:java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect。可以看到user为root,host为localhost的话,说明mysql只允许本机连接,那么外网,本地软件客户端就无法连接了。执行:update user set host='%' where user ='roo
·
报错:java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
解决:
在mysql的bin目录下执行:
mysql -u root -p
use mysql;
select host,user from user;
可以看到user为root,host为localhost的话,说明mysql只允许本机连接,那么外网,本地软件客户端就无法连接了。
调整方法:
update user set host='%' where user ='root';
执行刷新权限:
flush privileges;
可以测试外网连接mysql服务器。
但是要注意不要直接暴露出去,最好设置ip白名单,否则数据库会容易被黑客爆!
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐


所有评论(0)