MySQL | Java.sql.SQLException: null, message from server: "Host 'xxx.xxx.xxx.xxx' is not allowed to connect 异常解决

  做一个项目需要连接在笔记本上的MySQL数据库,但是创建Connection的时候出现错误:

java.sql.SQLException: null, message from server: "Host 'xxx.xxx.xxx.xxx' is not allowed to connect.

  这个异常的原因是数据库一开始是只允许localhost或者127.0.0.1访问的,不允许远程访问,需要修改访问权限。

  解决方法:

  

  flush privileges是为了将权限更新操作刷新到内存中,而不用下次启动时生效。

posted @ 2020-08-14 15:36  Tiger_Jiang  阅读(2357)  评论(0编辑  收藏  举报