You need to specify one of the following as an environment variable: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD
时间: 2023-11-25 07:06:38 浏览: 80
When setting up a MySQL container, you need to specify one of the following environment variables to configure the root password:
1. `MYSQL_ROOT_PASSWORD`: This variable sets the password for the root user explicitly.
2. `MYSQL_ALLOW_EMPTY_PASSWORD`: Setting this variable to any value allows the root user to have an empty password. Note that this is not recommended for production environments.
3. `MYSQL_RANDOM_ROOT_PASSWORD`: If you set this variable to any value, it will generate a random password for the root user.
Choose one of these variables based on your requirements and provide the appropriate value when running the MySQL container.
Here's an example of how you can set the `MYSQL_ROOT_PASSWORD` environment variable:
```bash
docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=your_password -d mysql:tag
```
Replace `your_password` with your desired root password and `tag` with the appropriate MySQL version or tag you want to use.
Remember to use a strong and secure password for production environments.
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)