jdbc SQLException:'Access denied for user 'myuser'@'36.248.247.251' (using password: YES)'原因及解决

      此问题的原因有三种:

        1.权限不足

        2.账号密码错误

        3.本地数据库中有用户名为空的用户

      如果是权限不足,通过cmd或sqldeveloper以管理员即root用户登陆数据库,执行grant all privileges on *.* to root@'%' identified by ’*******‘;语句。其中*号是密码。然后执行:flush privileges刷新权限。

      如果是账号或密码错误,看看数据驱动是否写错,如果是用ssm等框架的看看properties文件里用户名或密码后面用没有多空格。

     否则,登陆数据库,查询是否有用户名为空的用户。

      select user,password from user where user=' ';

      若有记录,则删除之:

      delete from user where user=' ';

      commit;

    

 

posted @ 2019-07-09 10:16  岁月难言  阅读(288)  评论(0编辑  收藏  举报