Skip to content

Instantly share code, notes, and snippets.

@abg
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save abg/9532115 to your computer and use it in GitHub Desktop.

Select an option

Save abg/9532115 to your computer and use it in GitHub Desktop.
IUS 5.6 my.cnf (verbose with extended comments)
### _______________________________________________________________________
### / Rackspace MySQL 5.6 Terse Configuration File \
### | |
### | This is a base configuration file containing the most frequently used |
### | settings with reasonably defined default values for configuring and |
### | tuning MySQL. Note that these settings can likely be further tuned in |
### | order to get optimum performance from MySQL based upon the database |
### | configuration and hardware platform. |
### | |
### | For many deployments, the only variables which need to be modified |
### | below are max-connections and innodb-buffer-pool-size. |
### | |
### \ http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html /
### -----------------------------------------------------------------------
### \ ^__^
### \ (oo)\_______
### (__)\ )\/\
### ||----w |
### || ||
[mysqld]
### General
datadir = /var/lib/mysql
#event-scheduler = 1
## Cause MySQL to exclude the following entries from SHOW DATABASES output
## This is primarily usefu to exclude system directories that MySQL should
## not be managing such as the ext* filesystem's lost+found directory when
## MySQL's datadir is a mountpoint.
ignore-db-dir = lost+found
tmpdir = /var/lib/mysqltmp
socket = /var/lib/mysql/mysql.sock
## Set this to change the way MySQL handles validation, data conversion, etc.
#sql-mode = NO_ENGINE_SUBSTITUTION
### Cache
table-definition-cache = 4096
table-open-cache = 4096
table-open-cache-instances = 8
## thread-cache-size is autotuned in MySQL 5.6+
#thread-cache-size = 16
## The query-cache is disabled by default in MySQL 5.6+. Often this can be a bottleneck
## to good performance, but if you know your particular workload benefits uncomment
## the following lines. Typically query-cache-size is optimal at <128M
#query-cache-size = 32M
#query-cache-type = on
### Per-thread Buffers
## Generally these should not be changed unless you know your particular workload
## benefits. In most cases, the lower MySQL defaults will provide the best
## performance.
#sort-buffer-size = 512K
#read-buffer-size = 512K
#read-rnd-buffer-size = 512K
#join-buffer-size = 512K
### Temp Tables
#tmp-table-size = 16M
#max-heap-table-size = 16M
### Networking
#back-log = 128
#interactive-timeout = 28800
max-connections = 400
max-connect-errors = 1000000
max-allowed-packet = 16M
## This prevents using host-based authentication. That means users must be
## created using an ip-address (ie 'myuser'@'192.168.100.1') or must make
## use of the % wildcard (ie 'myuser'@'%'). The benefit to not using
## host-based authentication is that DNS will not impact MySQL performance.
skip-name-resolve
## This controls how long MySQL waits before dropping idle connections
## This should be adjusted to match connection pool settings or expected
## idle time for your application.
wait-timeout = 600
### Storage Engines
### MyISAM
## Not sure what to set this to?
## Try running a 'du -sch /var/lib/mysql/*/*.MYI'
## This will give you a good estimate on the size of all the MyISAM indexes.
## (The buffer may not need to set that high, however)
key-buffer-size = 64M
## This setting controls the size of the buffer that is allocated when
## sorting MyISAM indexes during a REPAIR TABLE or when creating indexes
## with CREATE INDEX or ALTER TABLE.
myisam-sort-buffer-size = 128M
## Enable this to automatically repair corrupt MyISAM tables
## Note: with the BACKUP the original table will be backed up first and
## may use significant disk space over time.
#myisam-recover = FORCE,BACKUP
### InnoDB
## Note: While most settings in MySQL can be set at run-time, many InnoDB
## variables require restarting MySQL to take effect.
##
## These settings control how much RAM InnoDB will use. Generally, when using
## mostly InnoDB tables, the innodb-buffer-pool-size should be as large as
## is possible without swapping or starving other processes of RAM. The other
## two settings usually do not need to be changed, but can help for very large
## datasets.
#innodb-buffer-pool-size = 128M
## innodb-file-per-table is enabled by default in MySQL 5.6 and required to use
## specific InnoDB features such as compressed tables.
## You may want to disable this in environments with a very large number of tables
## or for legacy cases where you are upgrading an existing environment with
## innodb-file-per-table = 0
#innodb-file-per-table = on
#innodb-log-buffer-size = 8M
## The size of InnoDB's redo logs which can have an important impact on performance
## Heavy write workloads may benefit from increasing this to ~1GB or more
innodb-log-file-size = 128M
## innodb-open-files is autotuned in MySQL 5.6 based on table-open-cache, so you
## probably don't need to change this
#innodb-open-files = 300
### Replication
## Uncomment the following when enabling multi-master replication
## Do NOT uncomment these unless you know exactly what you are doing!
#auto-increment-offset = 1
#auto-increment-increment = 2
## This sets the format used when logging to the binary log
## - ROW will force row-based logging
## - STATEMENT will force statement-based (ie pre 5.1) logging
## - MIXED wil use both, depending on the situation
## Note that this setting has implications for both replication and
## backups, so do not change this unless you know what you are doing!
#binlog-format = STATEMENT
expire-logs-days = 7
#log-bin = /var/log/mysql/bin-log
## This is usually only needed when setting up chained replication.
#log-slave-updates = 1
#relay-log = /var/log/mysql/relay-log
relay-log-space-limit = 16G
## This should be enabled on conventional MySQL slaves
#read-only = 1
## Unique numeric id for a MySQL instance participating in replication
## This must be different for each MySQL instance participating in replication
#server-id = 1
## Adjusts how long the slave waits for data from the master
#slave-net-timeout = 60
## The following options are necessary for crash-safe replication, but do
## come at a performance cost which may not be suitable for all environments
#master-info-repository = TABLE
#relay-log-info-repository = TABLE
#sync-binlog = 1
#sync-master-info = 1
#sync-relay-log = 1
#sync-relay-log-info = 1
### Logging
## This option determines the destination for general query log and slow query log output.
## The option value can be given as one or more of the words TABLE, FILE, or NONE.
#log-output = FILE
#log-slow-slave-statements
#log-slow-admin-statements
#long-query-time = 2
#slow-query-log = 1
#slow-query-log-file = /var/lib/mysqllogs/slow-log
[mysqld_safe]
log-error = /var/log/mysqld.log
## malloc-lib can change the memory allocator for MySQL, which may increase performance
## for some workloads
#malloc-lib = /usr/lib64/libjemalloc.so.1
## If open-files-limit is set very low, MySQL may increase on its own. Either
## way, increase this if MySQL gives 'too many open files' errors.
open-files-limit = 65535
[mysql]
no-auto-rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment