ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'localhost' IDENTIFIED BY 'mypassword';

后端 未结 3 1714
日久生厌
日久生厌 2020-12-16 15:35

Mistakenly I deleted my root user from my mysql.user table.

delete from mysql.user where user=\'username\';

To make same root

3条回答
  •  春和景丽
    2020-12-16 16:34

    This user must be referenced in other tables from the mysql system schema. I would recreate the user the same way you deleted it:

    INSERT INTO mysql.user (user, host, password)
    VALUES ('root', 'localhost', PASSWORD('pasw'));
    

    Then

    FLUSH PRIVILEGES;
    GRANT ALL ON *.* TO 'root'@'localhost';
    

    Yet another reason to never mess with this schema (sorry, I couldn't help).

提交回复
热议问题