错误1356(HY000):视图'mysql.user'引用无效的表或列或函数或视图的定义者/调用者缺乏使用它们的权限

问题描述 投票:0回答:2

我尝试过查询,但出现错误。
有没有人解决这个错误?

MariaDB [mysql]> UPDATE user SET Host='%' WHERE User='root'; 
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
mysql mariadb
2个回答
56
投票

MariaDB-10.4+

mysql
user
是视图而不是表。

建议停止复制旧博客以在 MySQL 和 MariaDB 中进行任何与身份验证相关的更改,这些机制正在更新并且不再适用。请务必查看官方文档。

使用 SET PASSWORDALTER USER 管理用户身份验证。

修改用户名的用户/主机组件也会使触发器、事件、插件、授权、角色等与组合用户名不同步(也称为损坏)。因此,只需删除/创建用户而不是操纵他们。


0
投票

当引用表被删除时,会出现此错误。

mysql> create table f(a float);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into f values(1.34),(33.56);
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from f;
+-------+
| a     |
+-------+
|  1.34 |
| 33.56 |
+-------+
2 rows in set (0.00 sec)

mysql> create view fv as select * from f where a<10
;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from fv;
+------+
| a    |
+------+
| 1.34 |
+------+
1 row in set (0.00 sec)

mysql> drop table f;
Query OK, 0 rows affected (0.02 sec)

mysql> select * from fv;
ERROR 1356 (HY000): View 'revision.fv' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
mysql>
© www.soinside.com 2019 - 2024. All rights reserved.