Resolve Docker MySQL crashes
Published in
2 min readDec 14, 2018
What
Cause docker MySQL default lib has minimal memory settings for their performance.
It makes very frustrating crashes often.
So many of use case of this lib should add more ‘max_allowed_packet’ with ‘key_buffer_size’
How
- make a custom MySQL config file
mkdir mysqlconf && cd mysqlconf && vim gatewaymy.cnf
add below to gateway.cnf
[mysqld]max_allowed_packet = 64Mkey_buffer = 64M
2. Add custom MySQL config to your docker-compose.yml file
volumes:- ./mysqlconf:/etc/mysql/conf.d
./mysqlconf 👈 means relative path from your docker-compose.yml file
(example)
3. check configuration is applied
connect to MySQL container
docker-compose up -d && docker exec -it wordpress_wordpress_db_1 bash
check ‘max_allowed_packet’
mysql -p -e "show variables like '%max_allowed_packet%';"
check ‘key_buffer’
mysql -p -e "show variables like '%key_buffer%';"