过去两天我一直在监视我的服务器,并意识到我的临时表中有60%存储在hhd而不是内存中。 另外我运行MySQL Performance Tuning Primer脚本,build议我设置query_cache_size。
现在,要做到这一点,我相信我需要在my.cnf中设置query_cache_size和join_buffer_size
不幸的是,我没有编辑my.cnf文件的经验,所以我希望有人能够帮助我。 我该如何设置, 我应该怎么设置?
目前my.cnf:
[mysqld] set-variable = max_connections=500 safe-show-database log_slow_queries = /var/log/mysql/log-slow-queries.log slow_query_log = 1 long_query_time = 2 log-queries-not-using-indexes
MySQL参考指南中提供了可能的值(和其他信息)。 所以,例如,如果我想添加你指定的两个参数,你的/etc/my.cnfconfiguration将类似于以下内容:
[mysqld] set-variable = max_connections=500 safe-show-database log_slow_queries = /var/log/mysql/log-slow-queries.log slow_query_log = 1 long_query_time = 2 log-queries-not-using-indexes # (default: 0) thread_cache_size = 4 # Replaces table_cache in 5.1.3 (default: 64) table_open_cache = 128 # (default: 0), disables cache query_cache_size = 8388608
我使用的两个值是MySQL在未指定时使用的默认值。 一定要在这里指定你自己的价值!
更新:MySQL的技术资源也有一个很好的文章, 了解caching 。