Monday 9 January 2012

Optimized my.cnf (for 16G memory)

#After A LOT of customization headaches here is the config that works pretty well on my server
#This may not be the most optimized but is definitely good as starting point for a busy mysql/php server



#
# The MySQL database server configuration file.
#

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 128M
thread_stack = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 150
table_cache            = 2048
thread_concurrency     = 16

join_buffer_size = 8M
sort_buffer_size = 8M
max_heap_table_size = 512M
max_connect_errors = 10
tmp_table_size = 512M


#*** MyISAM Specific options
key_buffer_size = 32M
read_buffer_size = 2M
read_rnd_buffer_size = 16M

myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 5G
myisam_max_extra_sort_file_size = 5G



#
# * Query Cache Configuration
#
query_cache_limit = 2M
query_cache_size        = 96M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1

log_error                = /var/log/mysql/error.log

#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size         = 100M


[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

!includedir /etc/mysql/conf.d/




No comments:

Post a Comment