Docker Community Forums

Share and learn in the Docker community.

MySQL root password not being set to MYSQL_ROOT_PASSWORD environment variable

(Runeasgar) #1


root@docker:~/drupal# docker inspect drupal_mysql | grep MYSQL_ROOT_PASSWORD "MYSQL_ROOT_PASSWORD=test", root@docker:~/drupal# docker exec -it drupal_mysql mysql -u root -p Enter password: test ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I’ve gratuitously rebuilt, recreated, --no-cache’d, --force-recreate’d… nothing is working. I’ve also tried putting the environment variable directly in a mysql Dockerfile and as an “environment” argument in my docker-compose.yml.

The only thing that IS working is passing -e ‘MYSQL_ROOT_PASSWORD=test’ in a docker run statement.

(Runeasgar) #2

So, I’m kinda dumb. I put mapped /var/lib/mysql to mysql/data on the host. Ever since I did that, MySQL hasn’t bothered reconfiguring itself. It just keeps reading the info from the existing database info… I just blew that away, and am now going to test this again :\