Skip to content

Instantly share code, notes, and snippets.

@rafaelfoster
Last active March 6, 2017 04:13
Show Gist options
  • Save rafaelfoster/820780816c5d14e7421cadda7bc75406 to your computer and use it in GitHub Desktop.
Save rafaelfoster/820780816c5d14e7421cadda7bc75406 to your computer and use it in GitHub Desktop.
Mysql configuration
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
# this is only for embedded server
[embedded]
# This group is only read by MariaDB-5.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mysqld-5.5]
# These two groups are only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
[mariadb-5.5]
# GENERAL #
server-id = 2
user = mysql
default-storage-engine = InnoDB
#socket = /var/data/mysql.sock
pid-file = /var/data/mysql.pid
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 512M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = /var/data/db
# BINARY LOGGING #
log-bin = /var/data/db/mysql-bin
binlog_format = MIXED
expire-logs-days = 14
sync-binlog = 1
binlog-cache-size = 64M
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 1
query-cache-size = 128M
query-cache-limit =
max-connections = 500
thread-cache-size = 128
#open_files_limit = 65535
table-definition-cache = 4096
table-open-cache = 4096
tmpdir = /var/data/tmpfs/
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-buffer-size = 256M
innodb-log-files-in-group = 2
innodb-log-file-size = 256M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 20G
innodb_data_file_path = ibdata1:100G:autoextend:max:400G
innodb_buffer_pool_instances = 12
join-buffer-size = 256M
transaction-isolation = READ-COMMITTED
# LOGGING #
log-error = /var/data/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/data/mysql-slow.log
[mysqld_safe]
open_files_limit = 65535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment