MySQL Tuning in OpenBSD

Tuning

By changing the mysqld configuration /etc/my.cnf you can improve the performance of you MySQL server. I currently use the following values in a rather beefy Intel Core I5 server with 4 GB of memory.

...

# The MySQL server
[mysqld]
port            = 3306
socket          = /var/run/mysql/mysql.sock
skip-locking
key_buffer_size = 256M                  # default 8M
max_allowed_packet = 1M
table_open_cache = 1024                 # default 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 32                  # default 0
query_cache_size = 128M                 # default 0
thread_concurrency = 8                  # Number of CPU's*2

...

See example configurations in /usr/local/share/mysql/my-small.cnf, /usr/local/share/mysql/my-medium.cnf and /usr/local/share/mysql/my-large.cnf. I use most of the settings from a large configuration and some recommendations from the references below.

Restart the server after settings is changed.

/etc/rc.d/mysqld restart

References