-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
I'm switching from a configuration file to a command line configuration for MySQL 5.6, using this docker-compose.yml section:
version: '2.1'
services:
mysql:
image: mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=my_password
command:
- --character-set-server=utf8
- --collation-server=utf8_general_ci
- --innodb-buffer-pool-size=1G
- --innodb-flush-log-at-trx-commit=0
- --innodb-log-file-size=1G
- --max-allowed-packet=100M
volumes:
- mysqlvolume:/var/lib/mysql
volumes:
mysqlvolume:
The docker-entrypoint.sh initialization script will create the database (mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf) with the default InnoDB buffer pool (48 MB). It will then start mysqld and wait 30 seconds for it to initialize. This initialization includes recreating the buffer pool, which takes longer than 30 seconds in TravisCI (failed build). docker-entrypoint.sh exits early, and the root password remains unset. This leads to the follow-on errors, such as ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) and Host '172.18.0.9' is not allowed to connect to this MySQL server.
This does not happen when a configuration file is used, because mysql_install_db will initialize with the desired InnoDB buffer pool size.
Some options are:
- Pass options to
mysql_install_dbas well - Increase the timeout from 30 seconds to a larger value