Skip to content

Initialization script crashes with MYSQL_RANDOM_ROOT_PASSWORD #860

@akors

Description

@akors

The latest build of the image crashes when initializing a new database if MYSQL_RANDOM_ROOT_PASSWORD was set.

Run the following command:

docker run -e MYSQL_RANDOM_ROOT_PASSWORD=1  --rm -it mysql:5.7

Observe the following error message:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
/usr/local/bin/docker-entrypoint.sh: line 251:    77 Killed                  "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"

Note that this DOES occur with the label 5.7.38, but it does NOT occur with 5.7.28. Something must've gone wrong in the last update.

This works just fine:

docker run -e MYSQL_RANDOM_ROOT_PASSWORD=1  --rm -it mysql:5.7.28

Docker version:

docker version
Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:18:13 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.16
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.10
  Git commit:       f756502
  Built:            Thu May 12 09:15:57 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Full log:

2022-05-27 15:54:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.38-1debian10 started.
2022-05-27 15:54:58+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-05-27 15:54:58+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.38-1debian10 started.
2022-05-27 15:55:21+00:00 [Note] [Entrypoint]: Initializing database files
2022-05-27T15:55:28.517638Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-05-27T15:55:28.659931Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-05-27T15:55:28.681218Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-05-27T15:55:28.736724Z 0 [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: 6e2580fa-ddd5-11ec-a5d8-0242ac110002.
2022-05-27T15:55:28.737871Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-05-27T15:55:29.180769Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-05-27T15:55:29.180783Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-05-27T15:55:29.181137Z 0 [Warning] CA certificate ca.pem is self signed.
2022-05-27T15:55:29.224720Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-05-27 15:55:32+00:00 [Note] [Entrypoint]: Database files initialized
2022-05-27 15:55:32+00:00 [Note] [Entrypoint]: Starting temporary server
2022-05-27 15:55:32+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-05-27T15:55:39.141824Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-05-27T15:55:39.143861Z 0 [Note] mysqld (mysqld 5.7.38) starting as process 77 ...
2022-05-27T15:55:39.148693Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-05-27T15:55:39.148716Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-05-27T15:55:39.148719Z 0 [Note] InnoDB: Uses event mutexes
2022-05-27T15:55:39.148721Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-05-27T15:55:39.148722Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-05-27T15:55:39.148724Z 0 [Note] InnoDB: Using Linux native AIO
2022-05-27T15:55:39.148881Z 0 [Note] InnoDB: Number of pools: 1
2022-05-27T15:55:39.148974Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-05-27T15:55:39.151420Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-05-27T15:55:39.162076Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-27T15:55:39.164840Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-05-27T15:55:39.180462Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-05-27T15:55:39.195586Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-05-27T15:55:39.195697Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-05-27T15:55:39.217857Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-05-27T15:55:39.218606Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-05-27T15:55:39.218620Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-05-27T15:55:39.219177Z 0 [Note] InnoDB: 5.7.38 started; log sequence number 2749976
2022-05-27T15:55:39.219324Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-05-27T15:55:39.219578Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-05-27T15:55:39.223082Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220527 15:55:39
2022-05-27T15:55:39.228017Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-05-27T15:55:39.228037Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-05-27T15:55:39.228047Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-05-27T15:55:39.228052Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-05-27T15:55:39.228941Z 0 [Warning] CA certificate ca.pem is self signed.
2022-05-27T15:55:39.228983Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-05-27T15:55:39.230608Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2022-05-27T15:55:39.253859Z 0 [Note] Event Scheduler: Loaded 0 events
2022-05-27T15:55:39.254025Z 0 [Note] mysqld: ready for connections.
Version: '5.7.38'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
2022-05-27 15:55:39+00:00 [Note] [Entrypoint]: Temporary server started.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
/usr/local/bin/docker-entrypoint.sh: line 251:    77 Killed                  "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions