My docker-compose look like:
version: '3.4'
services:
mysql:
image: mysql:8.0
command:
- --default-authentication-plugin=mysql_native_password
volumes:
- ./mysql-data:/var/lib/mysql
env_file:
- .env
ports:
- 3306:3306
My .env file look like:
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=db
MYSQL_USER=user
MYSQL_PASSWORD=user
Now if I change the password in .env
file, it does not change the password in the docker container after the restart.
I suppose that happens because I have mapped volume from host to container and I think there are all settings saved.
My question is: How can I change the password for mysql, without modyfing or deleting mysql-data
folder?