MySQL优化语句

MySQL授权远程连接:grant all privileges on *.* to 'root'@'%' identified by '123456';

show global status;
show variables like 'max_connections'; 

show variables like '%slow%'; 
set global slow_query_log = ON;


show variables like '%long_query_time%'; 
set global long_query_time =5

// explain分析慢查询日志
more slow-query.log 

//profiling分析查询



-- 查看允许的最大并发连接数
show variables like 'max_connections'
-- 修改池子连接大小临时生效
set global max_connections=200;

-- 查看线程相关的状态变量
show status like'Threads%';

-- 查看thread_pool_size值
show variables like 'thread_pool_size'

show processlist

  

  

  

程序连接池, 大量访问的可以缓存;

MySQL数据库有几个配置选项可以帮助及时捕获低效SQL语句;

find / -name mysqldumpslow 

原文地址:https://www.cnblogs.com/Alexr/p/13682069.html