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是为了将权限更新操作刷新到内存中,而不用下次启动时生效。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM