Skip to content

Instantly share code, notes, and snippets.

@yvoronoy
Last active December 22, 2022 17:57
Show Gist options
  • Save yvoronoy/a705387c1c995fb071f656bdb951c714 to your computer and use it in GitHub Desktop.
Save yvoronoy/a705387c1c995fb071f656bdb951c714 to your computer and use it in GitHub Desktop.
MySQL Magento Config
[mysqld]
## After edit config you have to remove log files and restart mysql server
## because after changing innodb-log-file-size you should recreate ib_logfiles
## Stop MySQL server
## rm /data/dir/ib_logfile*
## Run MySQL server
##Table open cache under MacOS and MySQL 5.6 should be 250.
##Otherwise you will get error MySQL server has gone away
##table-open-cache = 250
table-open-cache = 4096
## Cache
table-definition-cache = 4096
thread-cache-size = 256
query-cache-size = 64M
query-cache-type = 1
## Per-thread Buffers
sort-buffer-size = 16M
## Temp Tables
max-heap-table-size = 512M
tmp-table-size = 512M
## Networking
interactive-timeout = 3600
max-connections = 400
max-connect-errors = 1000000
max-allowed-packet = 512M
skip-name-resolve
skip-secure-auth
wait-timeout = 28800
## MyISAM
key-buffer-size = 256M
#myisam-recover = FORCE,BACKUP
myisam-sort-buffer-size = 128M
## InnoDB
innodb-buffer-pool-size = 2G
innodb-log-file-size = 256M
innodb-thread-concurrency = 18
innodb_flush_log_at_trx_commit = 2
##Fastest
##innodb_flush_log_at_trx_commit = 0
@ooples
Copy link

ooples commented Jun 4, 2017

Is this updated to work with the latest magento and mysql versions? I'm using mysql Ver 15.1 Distrib 10.2.5-MariaDB, for Linux (x86_64) using readline 5.1 and magento 2.1.7

@HedonieBrazil
Copy link

here is some comment i got from my hosting regarding this configuration. can you confirm some parameter ? what are the characteristics of your server ? Thanks in advance !!

Here is a summary with all the updated settings before/after : (we are running on 2 CPU - 6 GB Ram)

## CACHE
# table_open_cache = 256 -> 4096
# table_definition_cache = 528 -> 4096
# thread_cache_size  = 1 -> 256
# query_cache_size = 64M -> 64M (already configured)
# query_cache_type = 0 -> 1
## PER-THREAD BUFFERS
# sort_buffer_size = 4M -> 16M
## TEMP TABLES
# max_heap_table_size = 8M -> 512M
# tmp_table_size = 8M -> 512M
## NETWORKING
# interactive_timeout = 30 -> 3600
# max_connections = 200 -> 400:
# max_connect_errors = 10 -> 1000000
# max_allowed_packet = 16M -> 512M
# skip_name_resolve = OFF -> ?
# skip_secure_auth deprecated
# wait_timeout = 30 -> 28800
## MyISAM
# key_buffer_size = 4M -> 256M
# myisam_recover = FORCE,BACKUP (commented ? what should I do)
# myisam_sort_buffer_size = 16M -> 128M
## InnoDB
# innodb_buffer_pool_size = 128M -> 2G
# innodb_log_file_size = 48M -> 256M
# innodb_thread_concurrency = 0 -> 18
# innodb_flush_log_at_trx_commit = 1 -> 0

3 parameters are not clear :

skip_name_resolve = OFF -> ? (currently off)
skip_secure_auth => deprecated on MySQL 5.7
myisam_recover = FORCE,BACKUP -> must be myisam_recover_options with parameters

Globally, you can see by yourself that some parameters were greatly upgraded, this implies our worry on the server futur performances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment