Mysql grant privileges get error ERROR 1133 (42000): Can't find any matching row in the user table

限于喜欢 提交于 2021-02-10 04:14:09

问题


I am trying to grant priv to my django user, but I got error says can't find any matching row in the user table. It is the user table. mysql> select user,grant_priv from user; +---------------+------------+ | user | grant_priv | +---------------+------------+ | root | Y | | mysql.session | N | | mysql.sys | N | | django | N | +---------------+------------+ Here is databases. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | django | | my_First_Django | | mysql | | performance_schema | | sys | +--------------------+ I used code below and got the error. mysql> grant all privileges on django.* to django@localhost identified by ''; ERROR 1133 (42000): Can't find any matching row in the user table btw I tried FLUSH PRIVILEGES; as well, and not work.

Anyone help? Thanks!


回答1:


Run from Root user:

grant all privileges on django.* to 'django'@'localhost' identified by '';

EDIT- Example

mysql> grant all privileges on testdb1.* to 'user1'@'localhost' identified by 'user1';                                                         Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)


来源:https://stackoverflow.com/questions/50483175/mysql-grant-privileges-get-error-error-1133-42000-cant-find-any-matching-row

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!