修改MySQL存储过程、函数、事件、触发器、视图的DEFINER
2015-07-28 14:12
751 查看
#修改存储过程、函数、事件、触发器、视图的 DEFINER
select definer from mysql.proc;
update mysql.proc set definer='billing@%';
select DEFINER from mysql.EVENTS;
update mysql.EVENTS set definer='billing@%';
select DEFINER from information_schema.VIEWS;
select concat("alter DEFINER=`billing`@`%` SQL SECURITY DEFINER VIEW ",TABLE_SCHEMA,".",TABLE_NAME," as ",VIEW_DEFINITION,";") from information_schema.VIEWS where DEFINER<>'billing@%';
select DEFINER from information_schema.TRIGGERS;
drop trigger upc.t_trigger1;
DELIMITER ;;
CREATE DEFINER=`billing`@`%` trigger upc.t_trigger1 before delete on upc.sys_sequences for each row
begin
insert into upc.sys_sequences_bak values(2,old.SEQUENCE_NAME,old.START_BY,old.INCREMENT_BY,old.LAST_NUMBER,old.JVM_STEP_BY,now());
end;;
DELIMITER ;
select definer from mysql.proc;
update mysql.proc set definer='billing@%';
select DEFINER from mysql.EVENTS;
update mysql.EVENTS set definer='billing@%';
select DEFINER from information_schema.VIEWS;
select concat("alter DEFINER=`billing`@`%` SQL SECURITY DEFINER VIEW ",TABLE_SCHEMA,".",TABLE_NAME," as ",VIEW_DEFINITION,";") from information_schema.VIEWS where DEFINER<>'billing@%';
select DEFINER from information_schema.TRIGGERS;
drop trigger upc.t_trigger1;
DELIMITER ;;
CREATE DEFINER=`billing`@`%` trigger upc.t_trigger1 before delete on upc.sys_sequences for each row
begin
insert into upc.sys_sequences_bak values(2,old.SEQUENCE_NAME,old.START_BY,old.INCREMENT_BY,old.LAST_NUMBER,old.JVM_STEP_BY,now());
end;;
DELIMITER ;
相关文章推荐
- mysql变量使用总结
- [转]Mysql 存储过程和函数区别
- MYSQL用户相关操作
- window下安装mysql后修改root账号的密码
- mysql命令
- Mysql错误及处理总结
- mysql 命令行脚本导入导出
- 源码编译MySQL5.6.24
- mysql数据库中的索引有那些、有什么用
- mysql创建索引
- mysql出现Unknown or incorrect time zone: 'NULL'
- mysql 慢查询
- mysql全量日志
- 重置root密码
- 查看mysql正在执行的SQL语句,使用profile分析SQL执行状态
- mysql模糊查找:一个表T2的某列数据,作为另一个表T1查找条件进行模糊查找
- mysql取time ,datetime字段显示问题
- MySQL安装文档
- windows 下重置mysql密码
- mysql 函数大全