Search This Blog

Tuesday, May 10, 2011

MySQL my.cnf configuration for a large Drupal site

For a large web site with hundreds of thousands of page views per day, it is important to increase certain parameters, such as the query cache, join buffers, key buffer, ..etc.
The following my.cnf file is from an Ubuntu server (Debian derived) with dual CPUs, and 2 GB of RAM. It assumes that you are using MyISAM tables only and not InnoDB.
Depending on what modules you have, you may need to adjust some of those parameters, but this is definitely a good start.

 

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

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

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
old_passwords = 1
bind-address = 127.0.0.1
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
join_buffer_size = 512K
max_connections = 150
log_slow_queries = /var/log/mysql/mysql-slow.log
skip-bdb
skip-innodb

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

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

[isamchk]
key_buffer = 16M
Related Posts with Thumbnails