Skip to content
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

Override root default superuser name #1028

Closed
metametadata opened this issue Feb 16, 2024 · 6 comments
Closed

Override root default superuser name #1028

metametadata opened this issue Feb 16, 2024 · 6 comments

Comments

@metametadata
Copy link

Would be great to have something like MYSQL_ROOT_USER environment variable to change the default root superuser name.

E.g. PostgreSQL (https://hub.docker.com/_/postgres) has POSTGRES_USER for that.

@LaurentGoderre
Copy link
Member

I can't find this usecase in the MySQL documentation. It's possible that it isn't meant to be configurable.

@tianon
Copy link
Member

tianon commented Feb 14, 2025

I'm going to close for now; if we can find documentation for how to do this in a supported way, we can reopen. 👍

@tianon tianon closed this as completed Feb 14, 2025
@metametadata
Copy link
Author

Can't the Docker container simply execute a query? E.g. from https://stackoverflow.com/a/19539029/4839573:

use mysql;
update user set user='admin' where user='root';
flush privileges;

@tianon
Copy link
Member

tianon commented Feb 15, 2025

It sure could, but then it might as well be dropped into /docker-entrypoint-initdb.d by users instead (and there's not a compelling reason for us to add explicit code for this). 😅

@tianon
Copy link
Member

tianon commented Feb 15, 2025

To put that another way, we've already got more behavior we've "invented" on top of a stock MySQL experience than we're comfortable with, so anything that doesn't have to be extra behavior invented by (and maintained by) us is good, and the thing that would make this compelling for us is if it could be done pre-initialization such that the database never has a root user to begin with. Without that, I'm afraid this isn't something we're willing to support/maintain officially.

@metametadata
Copy link
Author

I see, thanks! FWIW, I run containers programmatically and all the user name consts are defined in Clojure code. So for me as a consumer, it's more hassle to set up /docker-entrypoint-initdb.d to change the user name than to pass the env var.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants