gpt4 book ai didi

mysql docker 容器未启动,mysqld : Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)

转载 作者:行者123 更新时间:2023-11-29 07:21:31 49 4
gpt4 key购买 nike

我已经创建了一个 docker compose 文件来运行 mysql docker 容器并使用数据库脚本初始化数据库。

启动容器时出现以下错误。

account-service-db_1  | Initializing database
account-service-db_1 | mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)
account-service-db_1 | 2019-05-11T16:58:35.265463Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
account-service-db_1 | 2019-05-11T16:58:35.265550Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.16) initializing of server in progress as process 15
account-service-db_1 | 2019-05-11T16:58:35.268464Z 0 [ERROR] [MY-010460] [Server] --initialize specified but the data directory exists and is not writable. Aborting.
account-service-db_1 | 2019-05-11T16:58:35.268472Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/lib/mysql/ is unusable. You can safely remove it.
account-service-db_1 | 2019-05-11T16:58:35.269284Z 0 [ERROR] [MY-010119] [Server] Aborting
account-service-db_1 | 2019-05-11T16:58:35.270510Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
docker-swarm-account-service-mysql-demo_account-service-db_1 exited with code 1

经过研究,许多人建议在撰写文件中添加用户:“1000:50”将解决问题。但添加后我也遇到了同样的错误。

请在下面找到我的 docker-compose 文件

version: '3.7'

services:
account-service-db:
user: "1000:50"
image: mysql
environment:
- MYSQL_DATABASE=account-service
- MYSQL_USER=mysqluser
- MYSQL_PASSWORD=mysqlpassword
- MYSQL_ROOT_PASSWORD=mysqlpassword
volumes:
- "/Users/admin/dockerfiles/docker-swarm-account-service-mysql-demo/scripts/:/docker-entrypoint-initdb.d/"
- "/Users/admin/dockerfiles/docker-swarm-account-service-mysql-demo/account:/var/lib/mysql"
ports:
- "3306:3306"

deploy:
replicas: 1
placement:
constraints:
- node.labels.mysql.node == true
restart_policy:
condition: on-failure
delay: 10s
#max-attempts: 3

我正在 mac 机器上执行上述场景。请帮助我为什么在授予卷和脚本文件夹所有必要的权限后它的行为是这样的。

最佳答案

问题似乎与您的 account 文件夹有关。它可能已在使用中或已损坏。创建一个新文件夹并进行测试。

从撰写文件中的环境值中删除双引号。

如果正在挂载的主机上的文件夹没有所需的写入权限:

  1. ssh 到你的主机/节点
  2. chmod -R a+rwx/path/to/account/folder

关于mysql docker 容器未启动,mysqld : Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56092699/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com