search

Home  >  Q&A  >  body text

关于mysql grant权限语句的报错问题

我用 mysql -u root -p
登陆进去敲入命令
grant all on . to ja identified by '123' with grant option;
提示Query OK, 0 rows affected (0.00 sec)

退出后,用刚新建的ja账号登陆
mysql -u ja -p

提示 ERROR 1045 (28000): Access denied for user 'ja'@'localhost' (using password: YES)

请问为啥?

PHP中文网PHP中文网2836 days ago1063

reply all(4)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 13:40:43

    You need to refresh the system permission table [flush privilege] before this user can log in effectively

    flush privileges;

    reply
    0
  • 迷茫

    迷茫2017-04-17 13:40:43

    If you grant all on . to ja@localhost ...
    , there should be no error

    reply
    0
  • 黄舟

    黄舟2017-04-17 13:40:43

    The command format of

    grant is: mysql> grant all on . to 'user'@'ip' identified by 'password' with grant option;

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:40:43

    grant all on . to 'ja'@'%' identified by '123' with grant option;
    flush privileges;
    quit;
    then log in again Take a look: mysql -u ja -p 123

    reply
    0
  • Cancelreply