Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created April 13, 2023 18:57
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 AbhishekGhosh/34c676fc8edcf09e78eda19deb1a3b59 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/34c676fc8edcf09e78eda19deb1a3b59 to your computer and use it in GitHub Desktop.
MariaDB 16GB Dedicated Server
# The MariaDB configuration file
# File location /etc/mysql/mariadb.cnf
# Tweak suggested by Abhishek Ghosh, thecustomizewindows.com
# for 16GB dedicated server running Apache2, PHP for WordPress single site
# Test with Major Hayden's MySQL Tuner
# https://github.com/major/MySQLTuner-perl
#
[mysqld_safe]
nice = -15
[client]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysqld]
# GENERAL #
# user = mysql
default-storage-engine = InnoDB
# socket = /var/lib/mysql/mysql.sock
# pid-file = /var/lib/mysql/mysql.pid
skip-name-resolve = 1
# MyISAM #
key-buffer-size = 103K
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 32M
max-connect-errors = 100
sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
# DATA STORAGE #
datadir = /var/lib/mysql/
# BINARY LOGGING #
log-bin = /var/lib/mysql/mysql-bin
expire-logs-days = 4
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 128M
max-heap-table-size = 128M
query-cache-type = 1
query-cache-size = 32M
query_cache_limit = 800K
query_cache_min_res_unit = 2k
max-connections = 250
thread-cache-size = 100
open-files-limit = 6553
table-definition-cache = 3276
table-open-cache = 3276
performance_schema=ON
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 4
innodb-log-file-size = 128M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 2G
innodb-buffer-pool-instances = 2
innodb-large-prefix = true
innodb-file-per-table = true
# LOGGING #
log-error = /var/lib/mysql/mysql-error.log
# log-queries-not-using-indexes = 1
# slow-query-log = 1
# slow-query-log-file = /var/lib/mysql/mysql-slow.log
[client-server]
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment