MySQL Error #1133 - Can't find any matching row in the user table

后端 未结 9 988
时光说笑
时光说笑 2020-12-08 04:06

Unable to set password for a user using 3.5.2.2 - phpMyAdmin for 5.5.27 - MySQL. When trying to set the password while logged onto ph

9条回答
  •  误落风尘
    2020-12-08 04:18

    This error can occur if trying to grant privileges for a non existing user.

    It is not clear to me what MySQL considers a non existing user. But I suspect MySQL considers a user to exist if it can be found by a name (column User) and a host (column Host) in the user table.

    If trying to grant privileges to a user that can be found with his name (column User) but not by his name and host (columns User and Host), and not provide a password, then the error occurs.

    For example, the following statement triggers the error:

    grant all privileges on mydb.* to myuser@'xxx.xxx.xxx.xxx';
    

    This is because, no password being specified, MySQL cannot create a new user, and thus tries to find an existing user. But no user with the name myuser and the host xxx.xxx.xxx.xxx can be found in the user table.

    Whereas providing a password, allows the statement to be executed successfully:

    grant all privileges on mydb.* to myuser@'xxx.xxx.xxx.xxx' identified by 'mypassword';
    

    Make sure to reuse the same password of that user you consider exists, if that new "MySQL user" is the same "application user".

    Complete the operation by flushing the privileges:

    flush privileges;
    

提交回复
热议问题