dayi 2020-04-11
原贴:https://www.cnblogs.com/FondWang/p/10780999.html
今天在做每个月定时扣费的功能 用到了Mysql的Event Scheduler
昨完之后发现一个问题 Event Scheduler 默认是不开启的 要在mysql内执行SET GLOBAL event_scheduler=on;
重启服务之后 测试发现 事件还是未被调用 ,
然后在执行SHOW VARIABLES LIKE ‘event_scheduler‘; 查看,惊奇的发现 重启之后 event_scheduler 又被置为off了
最后只能在my.conf文件内加一行SET GLOBAL event_scheduler=on; 这样随着mysql服务的开启 Event Scheduler也会自动开启
1. mysql查询所有表:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘数据库名‘ AND TABLE_TYPE =‘BASE TABLE‘
mysql查询建表语句:
show create table `表名`
2.mysql查询所有视图:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘数据库名‘ AND TABLE_TYPE =‘VIEW‘
mysql查询视图创建语句:
show create view `视图名`
3.mysql查询所有函数:
SELECT name from mysql.proc where db= ‘ifms‘ and type=‘function‘
mysql查询函数定义语句:
SHOW CREATE FUNCTION `函数名`
4.mysql查询所有存储过程:
SELECT name from mysql.proc where db= ‘ifms‘ and type=‘procedure‘
mysql查询procedure定义语句:
SHOW CREATE procedure `存储过程名`
5.mysql查询所有触发器:
SELECT * FROM information_schema.`TRIGGERS`
mysql查询触发器定义语句:
select * from information_schema.triggers where TRIGGER_NAME=‘触发器名‘;