1、连接mysql数据库
mysql -uroot -p -h127.0.0.1 -P3306
2、列出所有session
show full processlist;
3、查看20条执行时间最长的SQL
select * from information_schema.PROCESSLIST ORDER BY TIME desc limit 20;
4、查看slave同步状态
show slave status\G
5、查看master binlog或者gtid当前位置
show master status\G
6、查看数据库是否为只读模式
show variables where Variable_name like ‘read_only‘ or Variable_name like ‘%uuid%‘ or Variable_name like ‘server_id‘;
7、列出所有用户
select user,host,concat(‘show grants for ‘,user,‘@\‘‘,host,‘\‘;‘) showSql from mysql.user;
8、查看事物提交基本及binlog写入时间
show variables where Variable_name like ‘innodb_flush_log_at_trx_commit‘ or Variable_name like ‘sync_%‘;
时间: 2024-10-22 21:55:34