mysql的安装目录里有support-files,里面有几份默认的配置
分别是 huge large medium 等,还有高压力的InnoDB的参考:

[root@aslibra support-files]# grep -v ^# my-huge.cnf
key_buffer = 384M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8

[root@aslibra support-files]# grep -v ^# my-large.cnf
key_buffer = 256M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8

[root@aslibra support-files]# grep -v ^# my-medium.cnf
key_buffer = 16M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

[root@aslibra support-files]# cat my-innodb-heavy-4G.cnf|grep -v ^#|grep -v "^$"
back_log = 50
max_connections = 100
max_connect_errors = 10
table_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
thread_concurrency = 8
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
default_table_type = MYISAM
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=mysql-bin
log_slow_queries
long_query_time = 2
log_long_format
server-id = 1
key_buffer_size = 32M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

一般情况下,自己根据机器的情况,复制一份到默认的配置文件的位置,替代默认配置
比如纯数据库的机器,有1-2G以上的内存,可以拷贝huge的那份,要不然默认配置效率不高,比如查询时容易用到磁盘做临时文件,这份可以提高内存的使用率。

对比一下几份配置的同一参数:

key_buffer = 16M
key_buffer = 256M
key_buffer = 384M
myisam_sort_buffer_size = 8M
myisam_sort_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_sort_buffer_size = 128M
query_cache_size= 16M
query_cache_size = 32M
query_cache_size = 64M
read_buffer_size = 256K
read_buffer_size = 1M
read_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 512K
read_rnd_buffer_size = 4M
read_rnd_buffer_size = 8M
read_rnd_buffer_size = 16M
sort_buffer_size = 512K
sort_buffer_size = 1M
sort_buffer_size = 2M
sort_buffer_size = 8M
table_cache = 64
table_cache = 256
table_cache = 512
table_cache = 2048

没有细节的技术可以解析,细节信息还是得查资料,这里只是列举对比一下,也许可以提醒大家使用内存和修改配置来优化mysql


原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Tags:
发表评论
AD
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐