Skip to content

Setting --innodb-log-file-size=1G leads to initialization failure, unable to connect as root #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jwhitlock opened this issue Dec 21, 2017 · 1 comment

Comments

@jwhitlock
Copy link

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_db as well
  • Increase the timeout from 30 seconds to a larger value
@yosifkit
Copy link
Member

Oh, any extra flags to mysql_install_db are passed to mysqld. 🤔 Maybe we can fix that.

For the short term, if you can switch to 5.7, then the flags you send as command will also be used on install:

echo 'Initializing database'
"$@" --initialize-insecure
echo 'Database initialized'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants