• MySQL error 1045(28000): Access denied for user ...


    Problem

    I have a database called hibernate in my MySQL server and I grant privileges to a user using this command
        > grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';
    Wildchar % means no matter where the user logs in mysql server from, the access should be allowed for further checking/verification.
    When I tried to log in as the newly created user from local host, I got this error:
        ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES)
    Also I tried some suggested solutions:
       > FLUSH PRIVILEGES:
       > SET PASSWORD FOR 'testuser'@'%'='testuser';
    None of them works.

    My solution:
    Using following two commands:
       > grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';
       > grant all on hibernate.* to 'testuser'@'localhost' identified by 'testuser';

    Theoretically, wildchar % should have included all hosts. But it may not cover localhost. Who knows

  • 相关阅读:
    团队选题与评审
    消息管家
    团队展示
    功能规格说明书
    测试与优化
    git分支管理
    MVC小结
    .Net基础加强
    结对编程
    个人作业1_软件工程
  • 原文地址:https://www.cnblogs.com/SophiaTang/p/2296512.html
Copyright © 2020-2023  润新知