gpt4 book ai didi

mysql - Docker mysql 停止并退出(1)

转载 作者:行者123 更新时间:2023-11-29 16:51:34 24 4
gpt4 key购买 nike

我试图在 docker 容器中启动我的 MySql。但是,它因代码退出而停止(1)。这是我的运行方式:

docker run --name demo-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=密码 -d mysql:latest --mount type=bind,source=$(pwd),target=/var/lib/mysql

这是容器的日志

Initializing database2018-10-12T17:50:42.694183Z 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.2018-10-12T17:50:42.694277Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.12) initializing of server in progress as process 31mbind: Operation not permittedmbind: Operation not permittedmbind: Operation not permittedmbind: Operation not permitted2018-10-12T17:51:10.497527Z 0 [ERROR] [MY-011071] [Server] unknown option '--mount'2018-10-12T17:51:10.497543Z 0 [Warning] [MY-010952] [Server] The privilege system failed to initialize correctly. If you have upgraded your server, make sure you're executing mysql_upgrade to correct the issue.2018-10-12T17:51:10.497551Z 0 [ERROR] [MY-010119] [Server] Aborting2018-10-12T17:51:14.130241Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.12)  MySQL Community Server - GPL.

请帮助我...

最佳答案

可能会有更好的答案,我曾经也使用 Docker 和 MySQL,但已经有一段时间了。

作为独立容器启动:

docker run -v $PWD:/var/lib/mysql --name demo-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:latest

然后像这样附加到它:

docker run -i -t demo-db /bin/bash

关于pwd使用的注意事项:

无需使用pwd命令,只需获取shell变量$PWD即可。当您执行 foo=$(pwd) 时,有点矫枉过正,因为您实际上是在子 shell 中运行 pwd 命令来返回 $PWD .

关于mysql - Docker mysql 停止并退出(1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52790084/

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