docker-compose文件如下:
mysql:
image: mysql:8.0
restart: unless-stopped
# docker安全验证
security_opt:
- seccomp:unconfined
environment:
SET_CONTAINER_TIMEZONE: 'true'
CONTAINER_TIMEZONE: Asia/Shanghai
MYSQL_DATABASE: $MYSQL_DATABASE
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
MYSQL_ROOT_HOST: '%'
command:
# MySQL8的密码验证方式默认是 caching_sha2_password,但是很多的连接工具还不支持该方式
# 就需要手动设置下mysql的密码认证方式为以前的 mysql_native_password 方式
--max_connections=1000
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--default-authentication-plugin=mysql_native_password
ports:
- "3307:3306"
volumes: # 宿主机目录:容器目录
- /etc/localtime:/etc/localtime:ro
- ./mysql/data:/var/lib/mysql
logging:
options:
max-size: "10m"
max-file: "10"
启动日志如下:有哪位朋友遇到过,帮忙解答一下,非常感谢~
2021-03-23 12:35:20+00:00 [Note] [entrypoint]: entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-23 12:35:21+00:00 [Note] [entrypoint]: Switching to dedicated user 'mysql'
2021-03-23 12:35:21+00:00 [Note] [entrypoint]: entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-23T12:35:21.352520Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1
2021-03-23T12:35:21.378616Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-03-23T12:35:21.933219Z 1 [Warning] [MY-012579] [InnoDB] fallocate(16, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:21.944869Z 1 [Warning] [MY-012579] [InnoDB] fallocate(17, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:21.978693Z 1 [Warning] [MY-012579] [InnoDB] fallocate(18, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:21.986211Z 1 [Warning] [MY-012579] [InnoDB] fallocate(19, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.008499Z 1 [Warning] [MY-012579] [InnoDB] fallocate(20, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.024585Z 1 [Warning] [MY-012579] [InnoDB] fallocate(21, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.050522Z 1 [Warning] [MY-012579] [InnoDB] fallocate(22, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.073595Z 1 [Warning] [MY-012579] [InnoDB] fallocate(23, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.112565Z 1 [Warning] [MY-012579] [InnoDB] fallocate(24, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.139899Z 1 [Warning] [MY-012579] [InnoDB] fallocate(25, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:35:22.189599Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-03-23T12:35:22.507890Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-03-23T12:35:22.646934Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-03-23T12:35:22.647157Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. encrypted connections are now supported for this channel.
2021-03-23T12:35:22.727303Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-03-23T12:35:22.794574Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2021-03-23T12:48:19.535601Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.23).
2021-03-23T12:48:21.536402Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 8 user: 'root'.
2021-03-23T12:48:21.536707Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 16 user: 'root'.
2021-03-23T12:48:21.536863Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 24 user: 'root'.
2021-03-23T12:48:21.537218Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 9 user: 'root'.
2021-03-23T12:48:21.537540Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 17 user: 'root'.
2021-03-23T12:48:21.537713Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 25 user: 'root'.
2021-03-23T12:48:21.538015Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 10 user: 'root'.
2021-03-23T12:48:21.539714Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 18 user: 'root'.
2021-03-23T12:48:21.539836Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 26 user: 'root'.
2021-03-23T12:48:21.540147Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 11 user: 'root'.
2021-03-23T12:48:21.540278Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 19 user: 'root'.
2021-03-23T12:48:21.540334Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 27 user: 'root'.
2021-03-23T12:48:21.540534Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 12 user: 'root'.
2021-03-23T12:48:21.540606Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 20 user: 'root'.
2021-03-23T12:48:21.540753Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 13 user: 'root'.
2021-03-23T12:48:21.540846Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 21 user: 'root'.
2021-03-23T12:48:21.540998Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 14 user: 'root'.
2021-03-23T12:48:21.541053Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 22 user: 'root'.
2021-03-23T12:48:21.541192Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 15 user: 'root'.
2021-03-23T12:48:21.541243Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 23 user: 'root'.
2021-03-23T12:48:22.807204Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
2021-03-23 12:51:37+00:00 [Note] [entrypoint]: entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-23 12:51:37+00:00 [Note] [entrypoint]: Switching to dedicated user 'mysql'
2021-03-23 12:51:37+00:00 [Note] [entrypoint]: entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-23T12:51:38.228026Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1
2021-03-23T12:51:38.250081Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-03-23T12:51:38.584782Z 1 [Warning] [MY-012579] [InnoDB] fallocate(16, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.594298Z 1 [Warning] [MY-012579] [InnoDB] fallocate(17, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.602624Z 1 [Warning] [MY-012579] [InnoDB] fallocate(18, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.611012Z 1 [Warning] [MY-012579] [InnoDB] fallocate(19, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.618933Z 1 [Warning] [MY-012579] [InnoDB] fallocate(20, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.627128Z 1 [Warning] [MY-012579] [InnoDB] fallocate(21, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.633122Z 1 [Warning] [MY-012579] [InnoDB] fallocate(22, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.641483Z 1 [Warning] [MY-012579] [InnoDB] fallocate(23, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.649836Z 1 [Warning] [MY-012579] [InnoDB] fallocate(24, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22
2021-03-23T12:51:38.655960Z 1 [Warning] [MY-012579] [InnoDB] fallocate(25, FALLOC_FL_PUNCH_HOLe | FALLOC_FL_KeeP_SIZe, 0, 16384) returned errno: 22