gpt4 book ai didi

mysql - information_schema.triggers 拒绝访问?

转载 作者:行者123 更新时间:2023-11-30 23:09:18 27 4
gpt4 key购买 nike

只是测试一些代码,尝试将所有触发器保存在数据库中然后重新创建它们

drop table if exists triggertemp;

create table triggertemp like information_schema.TRIGGERS;

insert into triggertemp (
select * from information_schema.TRIGGERS where TRIGGER_SCHEMA = 'id2target');

delete from information_schema.TRIGGERS where TRIGGER_SCHEMA = 'id2target';

-- and then to re-create them
insert into information_schema.TRIGGERS (select * from triggertemp);

但是我得到拒绝用户 'root'@'%' 访问数据库 information_schema。现在我已经为这个用户授予了每个模式的所有权限,但仍然没有。

我错过了特权吗?或者这是一个内置的安全装置,我正在处理错误的事情?

最佳答案

http://dev.mysql.com/doc/refman/5.6/en/information-schema.html说:

you can only read the contents of tables, not perform INSERT, UPDATE, or DELETE operations on them.

如果您想保留触发器然后恢复它们,您可以这样做:

$ mysqldump --triggers --no-create-db --no-create-info --no-data id2target > triggers.sql

$ mysql id2target < triggers.sql

关于mysql - information_schema.triggers 拒绝访问?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20558513/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com