docker 启动mysql问题,You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQ
dokcer启动mysql时,无法启动成功,查看日志报错为You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD[root@localhost /]# docker run -dit mysql --restart always -e MYS.
·
dokcer启动mysql时,无法启动成功,查看日志报错为You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
[root@localhost /]# docker run -dit mysql --restart always -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix_pwd" -e MYSQL_ROOT_PASSWORD="root_pwd" mysql-zabbix
5d6dadbf889fd7f3f6cfec8e45dc12a5560b9e8ccc4973dceaf3eb2cea34451b
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c5557254c6d9 tomcat "catalina.sh run" 43 minutes ago Up 28 minutes 8080/tcp fervent_goldstine
[root@localhost /]# docker logs 5d6dadbf889fd7f3f6cfec8e45dc12a5560b9e8ccc4973dceaf3eb2cea34451b
2019-12-13 09:39:38+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.18-1debian9 started.
2019-12-13 09:39:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2019-12-13 09:39:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.18-1debian9 started.
2019-12-13 09:39:39+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
通过查找文档,在使用mysql镜像的时候需要提供mysql用户名和密码,如果是使用root用户登录的时候,需要提供root用户的密码。提供密码的方式很简单,就是使用docker run 的-e 指令,但是有在启动的时候已对指定了相关参数为什么还是不行呢。
[root@localhost /]# docker run -dit --restart always -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix_pwd" -e MYSQL_ROOT_PASSWORD="root_pwd" mysql
ce1a2d4fbaef8aeb7ff4d788c834c744a39c1cee37fa574da2bfff07d699c151
[root@localhost /]#
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ce1a2d4fbaef mysql "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 3306/tcp, 33060/tcp recursing_mcnulty
c5557254c6d9 tomcat "catalina.sh run" 53 minutes ago Up 38 minutes 8080/tcp fervent_goldstine
发现自己范了一个低级错误,参数应该在容器之前添加,有时候顺序还是很重要的。
更多推荐
已为社区贡献2条内容
所有评论(0)