集装箱一直在重启我试过了
- docker-compose down -v
- 停靠程序卷rm
集装箱之前工作正常
2021-03-27 13:16:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-27 13:16:08+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-03-27 13:16:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-27 13:16:08+00:00 [ERROR] [Entrypoint]: MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user
Remove MYSQL_USER="root" and use one of the following to control the root user password:
- MYSQL_ROOT_PASSWORD
- MYSQL_ALLOW_EMPTY_PASSWORD
- MYSQL_RANDOM_ROOT_PASSWORD
字符串
Docker-compose.yml
mysql:
image: mysql:8.0
ports:
- 3306:3306
expose:
- "3306"
cap_add:
- SYS_NICE # CAP_SYS_NICE
volumes:
- ./cache/mysql:/var/lib/mysql
- ./conf-mysql.cnf:/etc/mysql/conf.d/mysql.cnf
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_PASSWORD=root
- MYSQL_USER=root
- MYSQL_DATABASE=mydb
restart: unless-stopped
型
6条答案
按热度按时间9vw9lbht1#
只需删除
MYSQL_USER
,它就可以正常工作,因为root
用户会自动创建。5q4ezhmt2#
用户
root
是保留的,并且在mysql启动时已经被创建。MYSQL_USER
必须是不同的名称,而不是root
。xt0899hw3#
我遇到了同样的问题,这就是我如何解决它。
转到docker-compose.yml文件并进行以下更改:
示例:这是我的配置...
数据库服务器:
字符串
cgvd09ve4#
最近官方mysql docker的更改导致了这个问题。更多细节可以查看this PR on github。
为了快速解决这个问题,您应该删除
MYSQL_USER=root
,您的docker-compose.yaml
文件应该看起来像这样字符串
bybem2ql5#
仅更新.env文件:
字符串
jljoyd4f6#
remove
MYSQL_USER=root
as root user is created by default and when you useMYSQL_USER=root
it tries to create a new normal user with nameroot
which cause conflict. do follow the image in this way:字符串
设置
MYSQL_ROOT_PASSWORD:"password_of_your_choice"
将为root用户设置密码,设置MYSQL_USER: "paradise" , MYSQL_PASSWORD: "bajbciu2dbwc"
将为您创建一个新用户。