- Mysql数据库大小查看
select table_schema,round(sum(data_length+index_length)/1024/1024/1024,4) from information_schema.tables group by table_schema;
2.查看正在执行的sql
SELECT * FROM information_schema.PROCESSLIST WHERE info IS NOT NULL;
3.查看innodb内核中的当前活跃(ACTIVE)事务
select * from information_schema.innodb_trx;
4. 查看当前状态产生的innodb锁
select * from information_schema.innodb_locks;
5. 查看当前状态产生的innodb锁等待
select * from information_schema.INNODB_LOCK_WAITS;
6.存储过程的信息都存储在 information_schema 数据库下的 Routines 表中
select name
from mysql.proc where db = ‘your_db_name’ and type
= ‘PROCEDURE’;
7.存储过程的信息也存放在information_schema.Routines,
举例:查阅名为 showstuscore 的存储过程的状态:
SELECT * FROM information_schema.Routines WHERE ROUTINE_NAME=存储过程名;
8.查询数据库中的存储过程和函数
select name
from mysql.proc where db = ‘xx’ and type
= ‘PROCEDURE’ //存储过程
select name
from mysql.proc where db = ‘xx’ and type
= ‘FUNCTION’ //函数
show procedure status; //存储过程
show function status; //函数
9.查看存储过程或函数的创建代码
show create procedure proc_name;
show create function func_name;
-
查看视图
SELECT * from information_schema.VIEWS //视图
SELECT * from information_schema.TABLES //表 -
查看触发器
SHOW TRIGGERS [FROM db_name] [LIKE expr]
SELECT * FROM triggers T WHERE trigger_name=”mytrigger” \G
以下为个人公众号,欢迎扫码关注: