我尝试过查询,但出现错误。
有没有人解决这个错误?
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
MariaDB-10.4+
mysql
。user
是视图而不是表。
建议停止复制旧博客以在 MySQL 和 MariaDB 中进行任何与身份验证相关的更改,这些机制正在更新并且不再适用。请务必查看官方文档。
使用 SET PASSWORD 或 ALTER USER 管理用户身份验证。
修改用户名的用户/主机组件也会使触发器、事件、插件、授权、角色等与组合用户名不同步(也称为损坏)。因此,只需删除/创建用户而不是操纵他们。
当引用表被删除时,会出现此错误。
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>