Laravel 8和Docker Desktop-MySQL问题(MySQL_PASSWORD不能用于root用户)



我真的很难设置mysql_1容器并使其运行。

所以,我只是按照说明安装了Laravel 8,首先下载了Docker Desktop,正确设置了WSL,除了MySQL之外,一切都很好。

我从Windows终端安装Laravel使用:

curl -s https://laravel.build/example-app | bash
cd example-app
./vendor/bin/sail up

一切正常(我可以在上访问应用程序http://localhost/),我可以使用VSCode等编辑文件。但我在尝试启动MySQL容器时遇到了这样的错误:

2021-03-22 11:02:21+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-22 11:02:21+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-03-22 11:02:21+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-03-22 11:02:21+00:00 [ERROR] [Entrypoint]: MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user
Use one of the following to control the root user password:
- MYSQL_ROOT_PASSWORD
- MYSQL_ALLOW_EMPTY_PASSWORD
- MYSQL_RANDOM_ROOT_PASSWORD

有人知道我应该改变什么才能让它发挥作用吗?附言:我还检查了3306端口,一切都很好(Windows防火墙没有阻止端口(。

提前谢谢。

当您启动MYSQL容器时,您应该传递一个带有-e MYSQL_ROOT_PASSWORD=yourpassword的环境变量

这对于MYSQL来说是必要的。您也可以使用他们提供给您使用的其他变量,它们都有自己的特殊性,但它们都定义了root用户的密码。这是一项要求。

最新更新