当前位置:   article > 正文

知识点 | MySQL常用的几条管控语句_mysql安全性控制语句包括

mysql安全性控制语句包括
  1. 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;

  1. 查看视图
    SELECT * from information_schema.VIEWS   //视图
    SELECT * from information_schema.TABLES   //表

  2. 查看触发器
    SHOW TRIGGERS [FROM db_name] [LIKE expr]
    SELECT * FROM triggers T WHERE trigger_name=”mytrigger” \G

以下为个人公众号,欢迎扫码关注:
image.png

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/955350
推荐阅读
相关标签
  

闽ICP备14008679号