-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What Happend
执行
MYSQL_ROOT_PASSWORD=$(openssl rand -base64 16) docker-compose up -dError Messages
报错
mysql-local-1 | 2025-07-01 01:10:24+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.42-1.el9 started.
mysql-local-1 | 2025-07-01 01:10:24+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql-local-1 | 2025-07-01 01:10:24+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.42-1.el9 started.
mysql-local-1 | 2025-07-01 01:10:24+00:00 [Note] [Entrypoint]: Initializing database files
mysql-local-1 | 2025-07-01T01:10:24.775653Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
mysql-local-1 | 2025-07-01T01:10:24.775677Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.42) initializing of server in progress as process 80
mysql-local-1 | 2025-07-01T01:10:24.792963Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
mysql-local-1 | 2025-07-01T01:10:25.038482Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql-local-1 | 2025-07-01T01:10:25.592857Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000029 - File '/docker-entrypoint-initdb.d/init.sql' not found (OS errno 1 - Operation not permitted)
mysql-local-1 | 2025-07-01T01:10:25.593167Z 0 [ERROR] [MY-010455] [Server] Failed to open the bootstrap file /docker-entrypoint-initdb.d/init.sql
mysql-local-1 | 2025-07-01T01:10:25.593183Z 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.
mysql-local-1 | 2025-07-01T01:10:25.593197Z 0 [ERROR] [MY-010119] [Server] Aborting
mysql-local-1 | 2025-07-01T01:10:27.398801Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.42) MySQL Community Server - GPL.
mysql-local-1 exited with code 1
Environment
- OS: macos arm
Additional Context
解决方法,docker compose mysql 部分改为如下
mysql-local:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- "db-data:/var/lib/mysql"
- "$PWD/db/my.cnf:/etc/my.cnf"
# - "$PWD/db/init.sql:/docker-entrypoint-initdb.d/init.sql"
ports:
- "3306:3306"mysql 起来后手动导入 init.sql
mycli -h 127.0.0.1 -uroot < db/init.sql网上也遇到挺多用 init file 出错的,暂时不知道啥根本原因
因为 docker 里 目录看着权限还挺正常,mysql用户也能读
drwxr-xr-x 1 root root 16 Jul 1 01:44 docker-entrypoint-initdb.d
-rw-r--r-- 1 root root 54K Jul 1 01:00 init.sql
jietian-sts and Esonhugh
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working