show profiles

show profiles:默认关闭 show variables like '%profiling%' set profiling = on show profiles会记录所有所有sql查询语句所花的时间 缺点:只能看到全部的总时间

show profile all

精确分析:show profile all for query 上一部查询的Query_id

全局日志

默认关闭:show global variables like '%general_log%'; set global general_log = 1 set global log_output = 'table' 开启后会记录所有sql,会被记录到mysql自带的数据库里面的general_log表里