Question - How to change existing DB password

As part of a security review we’re going to increase the strength of the DB passwords for db_username and for root specified in the .env file for our docker install. We already have data in the database. If I rerun docker compose with the new password in the .env file will that work or do I need to alter the credentials in the DB as well. I’m assuming its the latter.

Also changing the default username in the docker .env file has also been suggested. Is this likely to cause any issues?

I’m thinking I have to connect to the mysql DB, create a new user with permissions the same as the default docker user, add a new secure password, change the root password and then remove the docker user. Then update the ..env file and rerun the docker compose Are there tools within the docker container to allow me to do this db edit?. I’m happy using the mysql command line.

C

Yes, you also need to update the credentials in the database.

You should be fine changing the username as long as it has the same permissions.

Your steps are correct. I suggest just using the MySQL command line inside the MySQL container:

docker exec -it mysql mysql -u root -p

Thanks for that. I’ve got a sandbox here to test it on. Time to make a backup… :slight_smile: