# UK Data Services - MySQL Configuration for Production [mysqld] # Basic Settings user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 datadir = /var/lib/mysql tmpdir = /tmp # Character Set character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init-connect = 'SET NAMES utf8mb4' # Performance Settings innodb_buffer_pool_size = 256M innodb_log_file_size = 64M innodb_log_buffer_size = 16M innodb_flush_method = O_DIRECT innodb_file_per_table = 1 # Query Cache (MySQL 5.7 and below) query_cache_type = 1 query_cache_size = 64M query_cache_limit = 2M # Connection Settings max_connections = 200 max_user_connections = 180 max_connect_errors = 100000 # Buffer Settings key_buffer_size = 32M sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 thread_stack = 256K # Table Settings table_open_cache = 4000 table_definition_cache = 400 # Timeout Settings wait_timeout = 600 interactive_timeout = 600 connect_timeout = 10 # Logging log-error = /var/log/mysql/error.log slow_query_log = 1 slow_query_log_file = /var/log/mysql/slow.log long_query_time = 2 # Binary Logging (for replication) log-bin = mysql-bin binlog_format = ROW expire_logs_days = 7 max_binlog_size = 100M # Security local-infile = 0 symbolic-links = 0 # Performance Schema performance_schema = ON performance_schema_max_table_instances = 400 performance_schema_max_table_handles = 4000 [mysql] default-character-set = utf8mb4 [client] default-character-set = utf8mb4 port = 3306 socket = /var/run/mysqld/mysqld.sock