Reputation: 1529
I am building a MySQL image using buildah bud -f .podman/MySQL.conf -t localhost/mysql:mushroom
and the following dockerfile (located at .podman/MYSQL.conf)
FROM mysql:8.0
ENV MYSQL_ROOT_PASSWORD='password'
EXPOSE 3306
I start the container using:
podman run --rm -v mysql_data:/var/lib/mysql localhost/mysql:mushroom
After starting the container I podman exe -it [ID] /bin/bash
into the container cli.
running mysql -p
and entering the correct password returns access denied for user 'root'@'localhost' (using password: YES)
I have confirmed that the env var MYSQL_ROOT_PASSWORD is correctly set.
I have tried entering the password in the podman run command (using -e MYSQL_ROOT_PASSWORD=password
) I have confirmed that the volume mysql_data
doesn't exist when I start the container.
Any suggestions for other things to try?
Upvotes: 0
Views: 1660
Reputation: 1529
Everything worked after a reboot. My best guess is that the mysql_data volume still existed somehow, and held default login data.
Upvotes: 0
Reputation: 22952
All I can say is that it seems to work for me.
I used your example Dockerfile (the only thing I did was to trim all the whitespace it seems to have accidentally gained when you pasted it).
I saved it as Dockerfile
and then just used podman build .
.
Starting the image in one terminal with podman run 8a0516eaa26e
prints a load of log lines showing mysql startup and then ends with
[System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
In another terminal I ran podman exec -it happy_dijkstra /bin/bash
(that was the auto-generated container name I got) and tried to login to mysql with "password" and it worked. I have podman v3.4.2 here, but I would expect something as simple as this to have worked since v1. Are you sure there isn't a space or other odd character that has sneaked into the password you set?
Upvotes: 1