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:8.4.2 tag can not init with Data Dictionary initialization failed #1082

Closed
lystormenvoy opened this issue Sep 2, 2024 · 12 comments
Closed

Comments

@lystormenvoy
Copy link

The log show like

2024-09-02T08:34:57.752532Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-09-02T08:34:57.754536Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 116
2024-09-02T08:34:57.763848Z 0 [Warning] [MY-010001] [Server] Can't create thread to handle bootstrap (errno: 1)
2024-09-02T08:34:57.763907Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2024-09-02T08:34:57.763917Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2024-09-02T08:34:57.763924Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-09-02T08:34:57.764809Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

My create command:

docker run -d --name mysql -e "MYSQL_ROOT_PASSWORD=xxxxxxxxxxxxxxxx" --restart always \ 
-v /ava_app/mysql/binlogs:/ava_app/mysql/binlogs \
-v /ava_data/upload:/ava_data/upload \
-v /etc/localtime:/etc/localtime:ro \
-v /ava_app/mysql/conf:/etc/mysql \
-v /ava_app/timezone:/etc/timezone:ro \
-v /ava_app/mysql/logs:/var/log/mysql \
--network=host mysql:8.4.2

My config file:

[mysqld]
port=3306
max_connections=1000
symbolic-links=0
lower_case_table_names=1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
explicit_defaults_for_timestamp=true
skip-name-resolve=1
#validate-password=FORCE_PLUS_PERMANENT
plugin-load-add=validate_password.so

long_query_time=4
slow_query_log=1

#sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

binlog_format = ROW
log-bin = /ava_app/mysql/binlogs/mysql-bin
expire_logs_days = 7
max_binlog_size = 100m
binlog_cache_size = 4m
max_binlog_cache_size = 512m
server-id=1

My docker version:

Client: Docker Engine - Community
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:04 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:27 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
@tianon
Copy link
Member

tianon commented Sep 3, 2024

Hmm, this is kind of a hard one to help narrow down -- I don't see a mount for /var/lib/mysql in your list for persistent storage of the actual database data, is that intentional?

@lystormenvoy
Copy link
Author

Hmm, this is kind of a hard one to help narrow down -- I don't see a mount for /var/lib/mysql in your list for persistent storage of the actual database data, is that intentional?

yep,then the container will use volume, isn't it?

@1893945
Copy link

1893945 commented Sep 12, 2024

我也遇到了这个情况。
临时的,不安全的解决办法!!!
加参数 --privileged=true

我使用的是mysql:8.4.2,宿主机是VMware的CentOS-8

Client: Docker Engine - Community
Version: 26.1.3
API version: 1.41 (downgraded from 1.45)
Go version: go1.21.10
Git commit: b72abbb
Built: Thu May 16 08:34:39 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:06:48 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.32
GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0

================================================
运行docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2
或者
docker run --name mysql8 --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2
都会报错:
[ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
[ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

感觉应该是文件操作的权限问题,查看容器里的/etc/passwd文件:
mysql:x:999:999::/var/lib/mysql:/bin/bash

我把宿主机上的映射文件/mysqldb改为:
chown 999:999 /mysqldb
ls -l /mysqldb
显示的是:
drwxr-xr-x 7 systemd-coredump input 4096 9月 12 20:42 mysqldb

所以不知道是不是容器里mysql用户id和宿主机用户id对应不上引起的。
加了 --privileged=true 后让容器有操作宿主机的权限能够创建数据目录成功:

[root@localhost /]# docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:8.4.2
2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started.
2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started.
2024-09-12 12:42:04+00:00 [Note] [Entrypoint]: Initializing database files
2024-09-12T12:42:04.009794Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-09-12T12:42:04.010701Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 80
2024-09-12T12:42:04.014553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-12T12:42:04.292227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-12T12:42:05.692559Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2024-09-12T12:42:35.028026Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.
2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Database files initialized
2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Starting temporary server
2024-09-12T12:42:35.068442Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-09-12T12:42:35.455443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 121
2024-09-12T12:42:35.469948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-12T12:42:36.187825Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-12T12:42:36.562369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-09-12T12:42:36.562404Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-09-12T12:42:36.569025Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory.
2024-09-12T12:42:36.595673Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2024-09-12T12:42:36.596111Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 0 MySQL Community Server - GPL.
2024-09-12 12:42:36+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.

2024-09-12 12:42:38+00:00 [Note] [Entrypoint]: Stopping temporary server
2024-09-12T12:42:38.385319Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.2).
2024-09-12T12:42:39.904629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.2) MySQL Community Server - GPL.
2024-09-12T12:42:39.904650Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: Temporary server stopped

2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2024-09-12T12:42:40.419312Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-09-12T12:42:40.591614Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 1
2024-09-12T12:42:40.595375Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-12T12:42:40.722005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-12T12:42:40.869651Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-09-12T12:42:40.869686Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-09-12T12:42:40.871539Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory.
2024-09-12T12:42:40.884699Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 3306 MySQL Community Server - GPL.
2024-09-12T12:42:40.884756Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysql d/mysqlx.sock

========================================================
[root@localhost mysqldb]# docker exec -it 1041849e51d7 bash
bash-5.1# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.4.2 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)

mysql>

===============================================

希望作者能提供更安全的解决办法,谢谢

@1893945
Copy link

1893945 commented Sep 14, 2024

我也遇到了这个情况。 临时的,不安全的解决办法!!! 加参数 --privileged=true

我使用的是mysql:8.4.2,宿主机是VMware的CentOS-8

Client: Docker Engine - Community Version: 26.1.3 API version: 1.41 (downgraded from 1.45) Go version: go1.21.10 Git commit: b72abbb Built: Thu May 16 08:34:39 2024 OS/Arch: linux/amd64 Context: default

Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:48 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.32 GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0

================================================ 运行docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 或者 docker run --name mysql8 --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 都会报错: [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

感觉应该是文件操作的权限问题,查看容器里的/etc/passwd文件: mysql:x:999:999::/var/lib/mysql:/bin/bash

我把宿主机上的映射文件/mysqldb改为: chown 999:999 /mysqldb ls -l /mysqldb 显示的是: drwxr-xr-x 7 systemd-coredump input 4096 9月 12 20:42 mysqldb

所以不知道是不是容器里mysql用户id和宿主机用户id对应不上引起的。 加了 --privileged=true 后让容器有操作宿主机的权限能够创建数据目录成功:

[root@localhost /]# docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:8.4.2 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:04+00:00 [Note] [Entrypoint]: Initializing database files 2024-09-12T12:42:04.009794Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start. 2024-09-12T12:42:04.010701Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 80 2024-09-12T12:42:04.014553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:04.292227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:05.692559Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2024-09-12T12:42:35.028026Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Database files initialized 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Starting temporary server 2024-09-12T12:42:35.068442Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:35.455443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 121 2024-09-12T12:42:35.469948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:36.187825Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:36.562369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:36.562404Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:36.569025Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:36.595673Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock 2024-09-12T12:42:36.596111Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 0 MySQL Community Server - GPL. 2024-09-12 12:42:36+00:00 [Note] [Entrypoint]: Temporary server started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.

2024-09-12 12:42:38+00:00 [Note] [Entrypoint]: Stopping temporary server 2024-09-12T12:42:38.385319Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.2). 2024-09-12T12:42:39.904629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.2) MySQL Community Server - GPL. 2024-09-12T12:42:39.904650Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: Temporary server stopped

2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2024-09-12T12:42:40.419312Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:40.591614Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 1 2024-09-12T12:42:40.595375Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:40.722005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:40.869651Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:40.869686Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:40.871539Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:40.884699Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 3306 MySQL Community Server - GPL. 2024-09-12T12:42:40.884756Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysql d/mysqlx.sock

======================================================== [root@localhost mysqldb]# docker exec -it 1041849e51d7 bash bash-5.1# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.4.2 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)

mysql>

===============================================

希望作者能提供更安全的解决办法,谢谢

我重新在虚拟机中安装了CentOS8,精简化安装。然后重新pull and run mysql:8.4.2,成功运行了,不用加--privileged=true也没有问题了。

@tianon
Copy link
Member

tianon commented Sep 16, 2024

Nice, glad you got it figured out!

@tianon tianon closed this as completed Sep 16, 2024
@tianon
Copy link
Member

tianon commented Sep 16, 2024

Doh sorry, didn't remember this wasn't your thread. 🤦

@tianon tianon reopened this Sep 16, 2024
@lystormenvoy
Copy link
Author

我也遇到了这个情况。 临时的,不安全的解决办法!!! 加参数 --privileged=true
我使用的是mysql:8.4.2,宿主机是VMware的CentOS-8
Client: Docker Engine - Community Version: 26.1.3 API version: 1.41 (downgraded from 1.45) Go version: go1.21.10 Git commit: b72abbb Built: Thu May 16 08:34:39 2024 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:48 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.32 GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
================================================ 运行docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 或者 docker run --name mysql8 --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 都会报错: [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
感觉应该是文件操作的权限问题,查看容器里的/etc/passwd文件: mysql:x:999:999::/var/lib/mysql:/bin/bash
我把宿主机上的映射文件/mysqldb改为: chown 999:999 /mysqldb ls -l /mysqldb 显示的是: drwxr-xr-x 7 systemd-coredump input 4096 9月 12 20:42 mysqldb
所以不知道是不是容器里mysql用户id和宿主机用户id对应不上引起的。 加了 --privileged=true 后让容器有操作宿主机的权限能够创建数据目录成功:
[root@localhost /]# docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:8.4.2 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:04+00:00 [Note] [Entrypoint]: Initializing database files 2024-09-12T12:42:04.009794Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start. 2024-09-12T12:42:04.010701Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 80 2024-09-12T12:42:04.014553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:04.292227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:05.692559Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2024-09-12T12:42:35.028026Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Database files initialized 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Starting temporary server 2024-09-12T12:42:35.068442Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:35.455443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 121 2024-09-12T12:42:35.469948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:36.187825Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:36.562369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:36.562404Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:36.569025Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:36.595673Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock 2024-09-12T12:42:36.596111Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 0 MySQL Community Server - GPL. 2024-09-12 12:42:36+00:00 [Note] [Entrypoint]: Temporary server started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2024-09-12 12:42:38+00:00 [Note] [Entrypoint]: Stopping temporary server 2024-09-12T12:42:38.385319Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.2). 2024-09-12T12:42:39.904629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.2) MySQL Community Server - GPL. 2024-09-12T12:42:39.904650Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: Temporary server stopped
2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2024-09-12T12:42:40.419312Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:40.591614Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 1 2024-09-12T12:42:40.595375Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:40.722005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:40.869651Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:40.869686Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:40.871539Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:40.884699Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 3306 MySQL Community Server - GPL. 2024-09-12T12:42:40.884756Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysql d/mysqlx.sock
======================================================== [root@localhost mysqldb]# docker exec -it 1041849e51d7 bash bash-5.1# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.4.2 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
mysql>

希望作者能提供更安全的解决办法,谢谢

我重新在虚拟机中安装了CentOS8,精简化安装。然后重新pull and run mysql:8.4.2,成功运行了,不用加--privileged=true也没有问题了。

加权限是不合适的。另外其实解决方法我是升级docker版本可以。但我不太理解。

@joelzzhang
Copy link

我也遇到了这个情况。 临时的,不安全的解决办法!!! 加参数 --privileged=true

我使用的是mysql:8.4.2,宿主机是VMware的CentOS-8
Client: Docker Engine - Community Version: 26.1.3 API version: 1.41 (downgraded from 1.45) Go version: go1.21.10 Git commit: b72abbb Built: Thu May 16 08:34:39 2024 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:48 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.32 GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
================================================ 运行docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 或者 docker run --name mysql8 --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 都会报错: [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
感觉应该是文件操作的权限问题,查看容器里的/etc/passwd文件: mysql:x:999:999::/var/lib/mysql:/bin/bash
我把宿主机上的映射文件/mysqldb改为: chown 999:999 /mysqldb ls -l /mysqldb 显示的是: drwxr-xr-x 7 systemd-coredump input 4096 9月 12 20:42 mysqldb
所以不知道是不是容器里mysql用户id和宿主机用户id对应不上引起的。 加了 --privileged=true 后让容器有操作宿主机的权限能够创建数据目录成功:
[root@localhost /]# docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:8.4.2 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:04+00:00 [Note] [Entrypoint]: Initializing database files 2024-09-12T12:42:04.009794Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start. 2024-09-12T12:42:04.010701Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 80 2024-09-12T12:42:04.014553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:04.292227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:05.692559Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2024-09-12T12:42:35.028026Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Database files initialized 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Starting temporary server 2024-09-12T12:42:35.068442Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:35.455443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 121 2024-09-12T12:42:35.469948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:36.187825Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:36.562369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:36.562404Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:36.569025Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:36.595673Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock 2024-09-12T12:42:36.596111Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 0 MySQL Community Server - GPL. 2024-09-12 12:42:36+00:00 [Note] [Entrypoint]: Temporary server started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2024-09-12 12:42:38+00:00 [Note] [Entrypoint]: Stopping temporary server 2024-09-12T12:42:38.385319Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.2). 2024-09-12T12:42:39.904629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.2) MySQL Community Server - GPL. 2024-09-12T12:42:39.904650Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: Temporary server stopped
2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2024-09-12T12:42:40.419312Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:40.591614Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 1 2024-09-12T12:42:40.595375Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:40.722005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:40.869651Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:40.869686Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:40.871539Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:40.884699Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 3306 MySQL Community Server - GPL. 2024-09-12T12:42:40.884756Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysql d/mysqlx.sock
======================================================== [root@localhost mysqldb]# docker exec -it 1041849e51d7 bash bash-5.1# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.4.2 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
mysql>
希望作者能提供更安全的解决办法,谢谢

我重新在虚拟机中安装了CentOS8,精简化安装。然后重新pull and run mysql:8.4.2,成功运行了,不用加--privileged=true也没有问题了。

加权限是不合适的。另外其实解决方法我是升级docker版本可以。但我不太理解。

老铁,你是升级到docker的哪个版本解决

@lystormenvoy
Copy link
Author

我也遇到了这个情况。 临时的,不安全的解决办法!!! 加参数 --privileged=true

我使用的是mysql:8.4.2,宿主机是VMware的CentOS-8
Client: Docker Engine - Community Version: 26.1.3 API version: 1.41 (downgraded from 1.45) Go version: go1.21.10 Git commit: b72abbb Built: Thu May 16 08:34:39 2024 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:48 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.32 GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
================================================ 运行docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 或者 docker run --name mysql8 --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:8.4.2 都会报错: [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
感觉应该是文件操作的权限问题,查看容器里的/etc/passwd文件: mysql:x:999:999::/var/lib/mysql:/bin/bash
我把宿主机上的映射文件/mysqldb改为: chown 999:999 /mysqldb ls -l /mysqldb 显示的是: drwxr-xr-x 7 systemd-coredump input 4096 9月 12 20:42 mysqldb
所以不知道是不是容器里mysql用户id和宿主机用户id对应不上引起的。 加了 --privileged=true 后让容器有操作宿主机的权限能够创建数据目录成功:
[root@localhost /]# docker run --name mysql8 --rm -v /mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:8.4.2 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2024-09-12 12:42:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.2-1.el9 started. 2024-09-12 12:42:04+00:00 [Note] [Entrypoint]: Initializing database files 2024-09-12T12:42:04.009794Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start. 2024-09-12T12:42:04.010701Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.2) initializing of server in progress as process 80 2024-09-12T12:42:04.014553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:04.292227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:05.692559Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2024-09-12T12:42:35.028026Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Database files initialized 2024-09-12 12:42:35+00:00 [Note] [Entrypoint]: Starting temporary server 2024-09-12T12:42:35.068442Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:35.455443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 121 2024-09-12T12:42:35.469948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:36.187825Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:36.562369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:36.562404Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:36.569025Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:36.595673Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock 2024-09-12T12:42:36.596111Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 0 MySQL Community Server - GPL. 2024-09-12 12:42:36+00:00 [Note] [Entrypoint]: Temporary server started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2024-09-12 12:42:38+00:00 [Note] [Entrypoint]: Stopping temporary server 2024-09-12T12:42:38.385319Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.2). 2024-09-12T12:42:39.904629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.2) MySQL Community Server - GPL. 2024-09-12T12:42:39.904650Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: Temporary server stopped
2024-09-12 12:42:40+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2024-09-12T12:42:40.419312Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2024-09-12T12:42:40.591614Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.2) starting as process 1 2024-09-12T12:42:40.595375Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-09-12T12:42:40.722005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-09-12T12:42:40.869651Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-09-12T12:42:40.869686Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-09-12T12:42:40.871539Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is acce ssible to all OS users. Consider choosing a different directory. 2024-09-12T12:42:40.884699Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.2' socket: '/var/run/mysqld/my sqld.sock' port: 3306 MySQL Community Server - GPL. 2024-09-12T12:42:40.884756Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysql d/mysqlx.sock
======================================================== [root@localhost mysqldb]# docker exec -it 1041849e51d7 bash bash-5.1# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.4.2 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
mysql>
希望作者能提供更安全的解决办法,谢谢

我重新在虚拟机中安装了CentOS8,精简化安装。然后重新pull and run mysql:8.4.2,成功运行了,不用加--privileged=true也没有问题了。

加权限是不合适的。另外其实解决方法我是升级docker版本可以。但我不太理解。

老铁,你是升级到docker的哪个版本解决

忘了,大概是22之后吧

@LaurentGoderre
Copy link
Member

@lystormenvoy can you try these extra configs:

https://stackoverflow.com/a/55852262

@LaurentGoderre
Copy link
Member

Oooh, it could be a duplicate of #1058

@yosifkit
Copy link
Member

Agreed, closing as duplicate of #1058; see also #1058 (comment) and docker-library/official-images#16829

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

6 participants