Skip to content

Instantly share code, notes, and snippets.

@ivanrvpereira
Last active August 29, 2015 14:03
Show Gist options
  • Save ivanrvpereira/4cb78a6da9cab3360dcd to your computer and use it in GitHub Desktop.
Save ivanrvpereira/4cb78a6da9cab3360dcd to your computer and use it in GitHub Desktop.
Percona Mysql configurantion for a 4GB VPS
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysql]
# CLIENT #
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
skip-name-resolve
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = /var/lib/mysql
basedir = /usr
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
# BINARY LOGGING #
log-bin = /var/lib/mysql/mysql-bin
expire-logs-days = 14
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-log-file-size = 128M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 1G
# LOGGING #
log-error = /var/log/mysql-error.log
log-queries-not-using-indexes = 1
# enable only to debug
# SET GLOBAL slow_query_log = 'ON'; and FLUSH LOGS;
slow-query-log = 0
long_query_time = 2
slow-query-log-file = /var/lib/mysql/mysql-slow.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment