I have a docker-compose file setup like this:
version: '3'
services:
database:
image: mysql:5.6
volumes:
- dbdata:/var/lib/mysql
environment:
- "MYSQL_DATABASE=my_database_name"
- "MYSQL_USER=my_database_user"
- "MYSQL_PASSWORD=my_database_password"
- "MYSQL_ROOT_PASSWORD=my_root_password"
ports:
- "33061:3306"
volumes: dbdata:
I'm trying to login to the mysql cli client with root user & password (by first going into the container itself):
mysql -uroot -pmy_root_password
But I keep getting this error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I didn't set the mysql root password env var from the very beginning. I had to remove the created volume "dbdata" and run docker-compose up again. That fixed it. Thanks for the help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With