As the title suggests, this is how to change the setting value when setting the mysql password like this.
mysql: image: mysql:5.7.32 ports: - "3306:3306" volumes: - mysql_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: root_pass MYSQL_DATABASE: db_name MYSQL_USER: user1 MYSQL_PASSWORD: user1_pass volumes: mysql_data:
After changing docker-compose.yml normally, execute the following command to reflect the setting value.
docker-compose down --volumes docker-compose up -d
If you just go down and up normally, MySQL data with a password set will be used, so it will not work. Therefore, it is necessary to delete the volume as in the above command.