Skip to content
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

MySQL init process failed. #251

Closed
AdriVanHoudt opened this issue Jan 5, 2017 · 4 comments
Closed

MySQL init process failed. #251

AdriVanHoudt opened this issue Jan 5, 2017 · 4 comments

Comments

@AdriVanHoudt
Copy link

My command: $ docker run -d -p 3307:3306 --name sf-mysql -v $(pwd)/mysql:/etc/mysql/conf.d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.6.31

config-file.cnf located in $(pwd)/mysql:

[mysql]
binlog_format = ROW
character_set_server = utf8
collation_database = utf8_bin
collation_server = utf8_general_ci
explicit_defaults_for_timestamp = OFF
sql_mode = STRICT_TRANS_TABLES
innodb_large_prefix = ON
group_concat_max_len = 1000000
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda

Log from docker:

Initializing database
2017-01-05 09:01:58 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31) starting as process 30 ...
2017-01-05 09:01:58 30 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-05 09:01:58 30 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-05 09:01:58 30 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-05 09:01:58 30 [Note] InnoDB: Memory barrier is not used
2017-01-05 09:01:58 30 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-05 09:01:58 30 [Note] InnoDB: Using Linux native AIO
2017-01-05 09:01:58 30 [Note] InnoDB: Using CPU crc32 instructions
2017-01-05 09:01:58 30 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-01-05 09:01:58 30 [Note] InnoDB: Completed initialization of buffer pool
2017-01-05 09:01:58 30 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-01-05 09:01:58 30 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-01-05 09:01:58 30 [Note] InnoDB: Database physically writes the file full: wait...
2017-01-05 09:01:58 30 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-01-05 09:01:58 30 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-01-05 09:01:59 30 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-01-05 09:01:59 30 [Warning] InnoDB: New log files created, LSN=45781
2017-01-05 09:01:59 30 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-01-05 09:01:59 30 [Note] InnoDB: Doublewrite buffer created
2017-01-05 09:01:59 30 [Note] InnoDB: 128 rollback segment(s) are active.
2017-01-05 09:01:59 30 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-01-05 09:01:59 30 [Note] InnoDB: Foreign key constraint system tables created
2017-01-05 09:01:59 30 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-01-05 09:01:59 30 [Note] InnoDB: Tablespace and datafile system tables created.
2017-01-05 09:01:59 30 [Note] InnoDB: Waiting for purge to start
2017-01-05 09:01:59 30 [Note] InnoDB: 5.6.31 started; log sequence number 0
2017-01-05 09:02:03 30 [Note] Binlog end
2017-01-05 09:02:03 30 [Note] InnoDB: FTS optimize thread exiting.
2017-01-05 09:02:03 30 [Note] InnoDB: Starting shutdown...
2017-01-05 09:02:04 30 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2017-01-05T09:02:04.718239552Z 
2017-01-05T09:02:04.718277106Z 
2017-01-05 09:02:04 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31) starting as process 53 ...
2017-01-05 09:02:04 53 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-05 09:02:04 53 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-05 09:02:04 53 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-05 09:02:04 53 [Note] InnoDB: Memory barrier is not used
2017-01-05 09:02:04 53 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-05 09:02:04 53 [Note] InnoDB: Using Linux native AIO
2017-01-05 09:02:04 53 [Note] InnoDB: Using CPU crc32 instructions
2017-01-05 09:02:04 53 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-01-05 09:02:04 53 [Note] InnoDB: Completed initialization of buffer pool
2017-01-05 09:02:04 53 [Note] InnoDB: Highest supported file format is Barracuda.
2017-01-05 09:02:04 53 [Note] InnoDB: 128 rollback segment(s) are active.
2017-01-05 09:02:04 53 [Note] InnoDB: Waiting for purge to start
2017-01-05 09:02:04 53 [Note] InnoDB: 5.6.31 started; log sequence number 1625977
2017-01-05 09:02:04 53 [Note] Binlog end
2017-01-05 09:02:04 53 [Note] InnoDB: FTS optimize thread exiting.
2017-01-05 09:02:04 53 [Note] InnoDB: Starting shutdown...
2017-01-05 09:02:06 53 [Note] InnoDB: Shutdown completed; log sequence number 1625987
2017-01-05T09:02:06.798303858Z 
2017-01-05T09:02:06.798382762Z 
2017-01-05T09:02:06.798416222Z 
2017-01-05T09:02:06.798477148Z 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
2017-01-05T09:02:06.798574231Z 
  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h a3e54f0b6688 password 'new-password'
2017-01-05T09:02:06.798595605Z 
Alternatively you can run:
2017-01-05T09:02:06.798642548Z 
  /usr/bin/mysql_secure_installation
2017-01-05T09:02:06.798657830Z 
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
2017-01-05T09:02:06.798684997Z 
See the manual for more instructions.
2017-01-05T09:02:06.798697981Z 
Please report any problems at http://bugs.mysql.com/
2017-01-05T09:02:06.798711465Z 
The latest information about MySQL is available on the web at
2017-01-05T09:02:06.798724349Z 
  http://www.mysql.com
2017-01-05T09:02:06.798737034Z 
Support MySQL by buying support/licenses at http://shop.mysql.com
2017-01-05T09:02:06.798757709Z 
Note: new default config file not created.
Please make sure your config file is current
2017-01-05T09:02:06.798776586Z 
WARNING: Default config file /etc/mysql/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
2017-01-05T09:02:06.798814240Z 
Database initialized
MySQL init process in progress...
2017-01-05 09:02:07 0 [Note] mysqld (mysqld 5.6.31) starting as process 76 ...
2017-01-05 09:02:07 76 [Note] Plugin 'FEDERATED' is disabled.
2017-01-05 09:02:07 76 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-05 09:02:07 76 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-05 09:02:07 76 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-05 09:02:07 76 [Note] InnoDB: Memory barrier is not used
2017-01-05 09:02:07 76 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-05 09:02:07 76 [Note] InnoDB: Using Linux native AIO
2017-01-05 09:02:07 76 [Note] InnoDB: Using CPU crc32 instructions
2017-01-05 09:02:07 76 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-01-05 09:02:07 76 [Note] InnoDB: Completed initialization of buffer pool
2017-01-05 09:02:07 76 [Note] InnoDB: Highest supported file format is Barracuda.
2017-01-05 09:02:07 76 [Note] InnoDB: 128 rollback segment(s) are active.
2017-01-05 09:02:07 76 [Note] InnoDB: Waiting for purge to start
2017-01-05 09:02:07 76 [Note] InnoDB: 5.6.31 started; log sequence number 1625987
2017-01-05 09:02:07 76 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a25fd9ad-d325-11e6-b3b6-0242ac110004.
2017-01-05 09:02:07 76 [Warning] 'user' entry 'root@a3e54f0b6688' ignored in --skip-name-resolve mode.
2017-01-05 09:02:07 76 [Warning] 'user' entry '@a3e54f0b6688' ignored in --skip-name-resolve mode.
2017-01-05 09:02:07 76 [Warning] 'proxies_priv' entry '@ root@a3e54f0b6688' ignored in --skip-name-resolve mode.
2017-01-05 09:02:07 76 [Note] Event Scheduler: Loaded 0 events
2017-01-05 09:02:07 76 [Note] mysqld: ready for connections.
Version: '5.6.31'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process failed.

Things I tried from looking at other issues:

  • I checked my memory and the container has 2G max so that can't be the issue.
  • I also don't set the MYSQL_HOST env property so that also can't be the issue.

Only other thing I can imagine is some permission issue like http://stackoverflow.com/a/36265931/2339622

Anyone has an idea?

@AdriVanHoudt
Copy link
Author

Turns out my config was wrong
working version:

[mysqld]
character_set_server = utf8
collation_server = utf8_general_ci
explicit_defaults_for_timestamp = OFF
sql_mode = STRICT_TRANS_TABLES
innodb_large_prefix = ON
group_concat_max_len = 1000000
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda

for future people I debuged it with
docker run -p 3307:3306 --name sf-mysql -v $(pwd)/mysql:/etc/mysql/conf.d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -it --rm mysql:5.6.31 /bin/bash
then run mysqld —verbose to start the process, this way you get to see more errors

@vphantom
Copy link

vphantom commented Mar 12, 2018

For the record, you were actually hitting a 30-second timeout in the image's init script. You happen to have accelerated your initial import enough to take less than 30 seconds when you disabled the binlog.

I hit the same issue and finally found https://github.com/docker-library/mysql/blob/master/5.5/docker-entrypoint.sh#L101 where the 30-second timeout is hard-coded:

for i in {30..0}; do
	if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
		break
	fi
	echo 'MySQL init process in progress...'
	sleep 1
done
if [ "$i" = 0 ]; then
	echo >&2 'MySQL init process failed.'
	exit 1
fi

Edit: I see there are already pull requests open since April 6, 2016 on this problem: #288 and #159. I hope they'll eventually get merged.

@ukos-git
Copy link

ukos-git commented Aug 21, 2018

@AdriVanHoudt sorry for nuking this thread but I could not see the difference of the my.cnf at first sight so I created a diff from your first and last settings.

-[mysql]
-binlog_format = ROW
+[mysqld]
 character_set_server = utf8
-collation_database = utf8_bin
 collation_server = utf8_general_ci
 explicit_defaults_for_timestamp = OFF
 sql_mode = STRICT_TRANS_TABLES

@ukos-git
Copy link

ukos-git commented Aug 21, 2018

I had this problem on mariadb.

eventually there is a new environment variable available: MYSQL_START_TIMEOUT. I set it to

MYSQL_START_TIMEOUT=900

the patch comes from this PR: https://github.com/docker-library/mysql/pull/288/files

With this variable, initialization of big data files in a docker container successfully gets to the end. I think I also read something about an error message that is displayed if the server was not initialized and the root password was not set.

I got it to work on mysql docker container but unfortunately I think, this variable is not integrated to https://github.com/MariaDB/server yet as I could not get it to work there.

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

3 participants