最近在检查系统的时候发现,MySQL经常性的占满了几乎所有空余内存,查了下网上的资料,发现需要调整MySQL的参数来降低内存占用。

找到 My.ini 配置文件,在后面添加如下参数 performance_schema 参数进行优化:

performance_schema_accounts_size                       =100   
performance_schema_digests_size                        =5000  
performance_schema_events_stages_history_long_size     =1000  
performance_schema_events_stages_history_size          =10    
performance_schema_events_statements_history_long_size =1000  
performance_schema_events_statements_history_size      =10    
performance_schema_events_waits_history_long_size      =1000  
performance_schema_events_waits_history_size           =10    
performance_schema_hosts_size                          =100   
performance_schema_max_cond_classes                    =80    
performance_schema_max_cond_instances                  =1382  
performance_schema_max_digest_length                   =1024  
performance_schema_max_file_classes                    =50    
performance_schema_max_file_handles                    =32768 
performance_schema_max_file_instances                  =2557  
performance_schema_max_mutex_classes                   =200   
performance_schema_max_mutex_instances                 =5755  
performance_schema_max_rwlock_classes                  =40    
performance_schema_max_rwlock_instances                =3138  
performance_schema_max_socket_classes                  =10    
performance_schema_max_socket_instances                =230   
performance_schema_max_stage_classes                   =150   
performance_schema_max_statement_classes               =168   
performance_schema_max_table_handles                   =616   
performance_schema_max_table_instances                 =684   
performance_schema_max_thread_classes                  =50    
performance_schema_max_thread_instances                =288   
performance_schema_session_connect_attrs_size          =512   
performance_schema_setup_actors_size                   =100   
performance_schema_setup_objects_size                  =100   
performance_schema_users_size                          =100  

如果想停用 performance_schema ,可直接添加以下参数即可:

performance_schema = off


原文链接地址:https://blog.exsvc.cn/article/mysql-5-6-high-ram-usage.html
转载请注明:转载自 易科博客 ,谢谢!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注