mysqlのmy.iniファイルのサンプルの設定ファイルの値がどのように設定されているかチェック。mysqldの設定例を抜き出してみる。設定するときの参考にはなるだろうと思うので。
my-small.cnf
This is for a system with little memory (<= 64M) where MySQL is only used from time to time and it's important that the mysqld daemon doesn't use much resources. [mysqld] port = 3306 socket = /tmp/mysql.sock skip-locking key_buffer = 16K max_allowed_packet = 1M table_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 64K
my-medium.cnf
This is for a system with little memory (32M – 64M) where MySQL plays
an important part, or systems up to 128M where MySQL is used together with
other programs (such as a web server)
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
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
my-large.cnf
This is for a large system with memory = 512M where the system runs mainly MySQL.
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
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
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency = 8
my-huge.cnf
This is for a large system with memory of 1G-2G where the system runs mainly
MySQL.
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
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
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency = 8
そして、各設定数値に違いがあるものをさらに抜き出してみる。
my-small | my-medium | my-large | my-huge | |
---|---|---|---|---|
key_buffer | 16K | 16M | 256M | 384M |
max_allowed_packet | 1M | 1M | 1M | 1M |
table_cache | 4 | 64 | 256 | 512 |
sort_buffer_size | 64K | 512K | 1M | 2M |
read_buffer_size | 256K | 256K | 1M | 2M |
read_rnd_buffer_size | 256K | 512K | 4M | 8M |
net_buffer_length | 2K | 8K | ||
myisam_sort_buffer_size | 8M | 64M | 64M | |
thread_stack | 64K | |||
thread_cache_size | 8 | 8 | ||
query_cache_size | 16M | 32M | ||
thread_concurrency | 8 | 8 |