Skip to content

Instantly share code, notes, and snippets.

@TimSimmons
Created October 17, 2014 20:10
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 TimSimmons/5b7fa48d95d7ee364d38 to your computer and use it in GitHub Desktop.
Save TimSimmons/5b7fa48d95d7ee364d38 to your computer and use it in GitHub Desktop.
MySQL Config
#
# Generated by Chef for galera-1
#
# Local modifications will be overwritten.
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.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
tmpdir = /tmp
default-storage-engine = innodb
skip-name-resolve
# Charset and Collation
character-set-server = utf8
collation-server = utf8_general_ci
event_scheduler = 0
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 32
sort_buffer_size = 2M
read_buffer_size = 128k
read_rnd_buffer_size = 256k
join_buffer_size = 128k
auto-increment-increment = 1
auto-increment-offset = 1
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
max_connections = 1500
max_connect_errors = 100
concurrent_insert = 2
connect_timeout = 10
wait_timeout = 28800
net_read_timeout = 30
net_write_timeout = 30
back_log = 128
table_cache = 8192
tmp_table_size = 32M
max_heap_table_size = 32M
bulk_insert_buffer_size = 32M
open-files-limit = 65535
# Default Table Settings
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# * Replication
#
#
# Here you can see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 2
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
log_bin = /var/lib/mysql/mysql-bin.log
binlog_format = statement
log_slave_updates = false
expire_logs_days = 3
max_binlog_size = 100M
binlog_cache_size = 32K
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
sync_binlog = 1
slave_compressed_protocol = 0
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
## InnoDB Plugin Independent Settings
innodb_data_home_dir = /var/lib/mysql
innodb_log_group_home_dir = /var/lib/mysql
innodb_file_per_table
innodb_table_locks = true
innodb_lock_wait_timeout = 60
innodb_thread_concurrency = 16
innodb_commit_concurrency = 16
innodb_support_xa = true
innodb_buffer_pool_size = 3G
innodb_log_file_size = 256M
innodb_additional_mem_pool_size = 8M
innodb_data_file_path = ibdata1:10M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# 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
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
no-auto-rehash # faster start of mysql but no tab completition
[myisamchk]
key_buffer = 16M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 2147483648
myisam_repair_threads = 1
myisam-recover = BACKUP
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1
#
# * 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