gpt4 book ai didi

mysql - 改变 '/var/lib/mysql/' : Permission denied 的所有权

转载 作者:可可西里 更新时间:2023-11-01 07:38:27 24 4
gpt4 key购买 nike

环境:docker for windows 10
版本:Docker 版本 17.09.0-ce,构建 afdb6d4
docker 镜像:mysql/mysql-server latest
docker 已设置共享驱动器 C:


我想运行一个 mysql 容器,所以我使用以下命令:

C:\WINDOWS\system32>docker run -d -p 3306:3306 -v "C:/Program Files/MySQL/Config":/etc/mysql/ -v "C:/Program Files/MySQL/Data/":/var/lib/mysql/ --name mysqlserver mysql/mysql-server
c2b45a6668746f0aa708b17f05a720ee6b4cff477eeaef714685293d1b60f44b

C:\WINDOWS\system32>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2b45a666874 mysql/mysql-server "/entrypoint.sh my..." 9 seconds ago Exited (1) 7 seconds ago mysqlserver
2de1dbd9880b redis "docker-entrypoint..." 4 days ago Exited (0) 4 days ago myredis
35c805969295 redis "docker-entrypoint..." 9 days ago Exited (0) 9 days ago redisServer

C:\WINDOWS\system32>docker logs mysqlserver
[Entrypoint] MySQL Docker Image 5.7.21-1.1.3
[Entrypoint] No password option specified for new database.
[Entrypoint] A random onetime password will be generated.
chown: changing ownership of '/var/lib/mysql/': Permission denied

C:\WINDOWS\system32>

this is the screenshot

我累了,我该怎么办?

最佳答案

在指定卷安装时尝试使用 rw 标签。在你的情况下是

docker run -d -p 3306:3306 -v "C:/ProgramFiles/MySQL/Config":/etc/mysql/:rw -v "C:/ProgramFiles/MySQL/Data/":/var/lib/mysql/:rw --name mysqlserver mysql/mysql-server

关于mysql - 改变 '/var/lib/mysql/' : Permission denied 的所有权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48729362/

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