New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Compose mysql MYSQL_ROOT_PASSWORD not work #180
Comments
Are you mapping to an existing database or creating a new one? |
@ltangvald hi, i just wanna set the root password when start docker, but it not work |
@ltangvald |
Creation of databases also only happens in there's no existing datadir. Did you map a volume containing an existing MySQL database when starting up the container? |
no |
sorry, my bad, i know the reason, just |
@iawia002 i am also having same problem, i tried with your solution is not for me. |
@bhaskar423 Could you describe exactly what you're doing and what happens? |
Sure, acutely i took the image from the public docker hub 8.0.13 image and i want to give the MYSQL password while up the container with environment variable, |
Same here, with mariadb:latest image. I already mapped /var/lib/mysql externally, but whatever I do, it does not seem to pickup on the environment set password for root. |
@jult one thing I have noticed is that the root user is created but only allowed to login from localhost so you can't log in from anything other than by connecting via the shell. |
Important to note that the image entrypoint script will never make changes to an existing database. |
same issue, thanks to @ltangvald ,his answer work well for me |
Some workarounds:Remove all unused volumesdocker volume prune Remove one or more volumesTo remove the volume from your db servicedocker volume rm <database_data> Docker compose Down containers e remove volumesdocker-compose down --volumes |
I mapping to an existing database. Does this mean that my MYSQL_PASSWORD and MYSQL_USER are not working ? |
@Paladinhanxiao |
Removing a volume potentially means removing all images and hence containers or not? That would be hardly a solution |
Removing the volume means removing all your stored data - images and containers are separate from that. Unfortunately, we do not have the bandwidth to provide in-depth integration/deployment/environment debugging or support here; these sorts of questions/requests would be more appropriately posted to a dedicated support forum, such as the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow. |
here is my config file:
I start docker, when i try to connect mysql using
test
as password, failed.the password is still
root
The text was updated successfully, but these errors were encountered: