SELECT convert(sql_text USING utf8),query_time,rows_examined from mysql.slow_log order by query_time desc;
show status like '%max_connections%'; ##mysql最大连接数
set global max_connections=1000 ##重新设置
show variables like '%max_connections%'; ##查询数据库当前设置的最大连接数
show global status like 'Max_used_connections'; ##服务器响应的最大连接数
show status like 'Threads%';
Variable_name Value
Threads_cached 0 ##mysql管理的线程池中还有多少可以被复用的资源
Threads_connected 152 ##打开的连接数
Threads_created 550 ##表示创建过的线程数,如果发现Threads_created值过大的话,表明MySQL服务器一直在创建线程,这也是比较耗资源,可以适当增加配置文件中thread_cache_size值,查询服务器
Threads_running 1 ##激活的连接数,这个数值一般远低于connected数值,准确的来说,Threads_running是代表当前并发数
show variables like 'thread_cache_size';
set global thread_cache_size=60;
-- 查看正在被锁定的的表
show OPEN TABLES where In_use > 0;
//查看慢查询时间 show variables like "long_query_time";默认10s
//查看慢查询配置情况 show status like "%slow_queries%";
//查看慢查询日志路径 show variables like "%slow%";