mysql show 命令汇总

1、查看二进制日志信息
show master logs

show binary logs

2、查看二进制日志中的事件

show binlog events in 'binlog.00001' from pos limit [offset] row_count;

3、show 字符集
show character set  like 'patten' | where expr;

4、查询表中的列

show collumns from table_name;

5、查看见库语句

show create database db_name;

6、查看建表语句

show create table table_name;

7、查看创建事件的语句
show create event envent_name;

8、查看创建函数语句
show create funcation func_name;

9、创建触发器的语句

show create tigger trig_name;

10、查看创建用户的语句
show create user user_name;

11、查看创建视图的语句
show create view view_name;

12、查看存储引擎状态或互斥参数
show engine envent_name [ status | mutex ];

show engine innodb status
show engine inndob mutex

13、查看sql语句的错误信息
show errors 
show count(*) errors

14、查看当前用户、当前库
show current_user, schema();

15、查看事件

show events 【 {from | in } schema_name 】 [ like 'patten' | where expr ]

16、查看用户的权限

show grants for user_or_role

show grants for 'admin@'10.0.0.0';

show grants for  'app'@'localhost';

查看当前用户的权限
show grants;
show grants for current_user();
show grants for current_user;

17、查看表中的索引

show index from table_name;
show index in table_name;

18、主从复制中的master 服务器的状态

show master status;

19、查看从服务器的状态
show slave status;

20、查看已经打开的非临时表

show open tables from db_name;
show open tables in db_name;

21、查看mysql服务的插件信息
show plugins

22、查看mysql支持那些权限
show privileges;

23、查看当前的所有的进程信息

show full  processlist;

full 关键字显示所有info列的信息。
不带关键字full 时只显示前100字符。

24、查看SQL语句资源使用情况

show profile  [type [, type ] ]  
[ for query n ]

[ limit row_count [ OFFSET offset]]

type: {
all
block io
context switches
cpu
ipc
memory
page faults
source
swaps
}


实例:

select @@profiling;

set profiling = 1;

drop table if exists t1;
create table t1;
show profiles;

show profile for query 1;

show profile cpu,memory for query 2;

25、查看中继日志中的事件

show relaylog events  [in 'log_name' ] [from  pos ] [limit [offset, row_count ] [channel_option]

channel_option:
for channel  channel 

show relaylog in 'relaylog.00009' from '12344335' for channel channel_name;


26、查看一个主从复制集群中包括几个从服务器;
show slave hosts;

8.0.22 之后
show replicas;

show relica status\G

27、 查看全局、session 变量和参数

show global | session variables  like '';

28、查看某个库中表的信息

show table status in | from db_name;

29、查看全局或局部变量
show global | session variables like '' 

30、 查看告警信息
show warnings;
show count(*) warnings;
select @@warning_count;

31、刷新日志(日志轮转)

flush  [ no_write_to_binlog | local ] {
 flush_option [, flush_option] .... 
 | table_option
}

flush_option: {
binary   logs
engine   logs
error    logs
general  logs
hosts
logs
privilges
optimizer_costs
relay logs for channel channel_name
slow logs
status
user_resources 
}

table_option: {
tables
tables tbl_name [, tbl_name] ....
tables with read lock
tables tbl_name [, tbl_name ] .... with read  lock;

32、杀死某个链接线程或请求

kill pid;


33、reset  reset_option : {
master | replica | slave }


 

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值