Summary of MySQL Optimization Tips

Three major directions of MySQL optimization

① Hardware optimization
② Optimize MySQL configuration parameters (my.cnf) This optimization requires a stress test to adjust parameters.
③ Optimize SQL statements and tables.
 
 

Hardware optimization

Optimization of hardware such as cpu, memory, hard disk, etc.

 

MySQL parameter optimization

Set the maximum number of connections
set globle max_connections = 5000;

long_query_time = 2 queries longer than two seconds are logged

log_slow_queries = /data/mysql/slowlog.log

Query_cache_type can be 0 , 1, 2, 0 means do not use cache, 1 means use cache, 2 means use as needed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325105841&siteId=291194637