我正在尝试向我的django用户授予priv,但是我收到错误,说在用户表中找不到任何匹配的行。
它是用户表。
mysql> select user,grant_priv from user;
+---------------+------------+
| user | grant_priv |
+---------------+------------+
| root | Y |
| mysql.session | N |
| mysql.sys | N |
| django | N |
+---------------+------------+
这是数据库。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| django |
| my_First_Django |
| mysql |
| performance_schema |
| sys |
+--------------------+
我使用下面的代码并得到错误。
mysql> grant all privileges on django.* to django@localhost identified by '';
ERROR 1133 (42000): Can't find any matching row in the user table
顺便说一句,我也试过FLUSH PRIVILEGES;
,但没有工作。
有人帮忙吗?谢谢!
答案 0 :(得分:4)
从Root用户运行:
grant all privileges on django.* to 'django'@'localhost' identified by '';
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)