Skip to content

Instantly share code, notes, and snippets.

@typhonius
Created February 23, 2013 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typhonius/5018218 to your computer and use it in GitHub Desktop.
Save typhonius/5018218 to your computer and use it in GitHub Desktop.
A configured my.cnf for a 4GB server also running FPM/Apache
#
# 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
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
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 = 100
#table_cache = 64
#thread_concurrency = 10
#unique additional
# * Logging
slow_query_log
slow_query_log_file=/var/log/mysql/mysql-slow.log
long_query_time=2
log-queries-not-using-indexes
log_bin=/var/log/mysql/mysql-bin
expire_logs_days=10
max_binlog_size=100M
tmp_table_size = 2048M
max_heap_table_size = 2048M
# * Query Cache Configuration
query_cache_size = 32M
query_cache_limit = 4M
key_buffer_size = 64K
thread_cache_size = 4
table_open_cache = 4000
max_allowed_packet = 128M
thread_stack = 64K
sort_buffer_size = 512K
read_rnd_buffer_size = 512K
read_buffer_size = 512K
join_buffer_size = 1M
net_buffer_length = 2K
tmpdir=/dev/shm
skip-external-locking
collation_server=utf8_general_ci
character-set-server=utf8
max_connections = 100
# * InnoDB
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
innodb_flush_method=O_DSYNC
innodb_buffer_pool_size=1024M
innodb_log_buffer_size=5M
[mysqldump]
quick
quote-names
max_allowed_packet = 80M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment