-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
mysql: adding option to create databases and users #6963
Conversation
Is there some way to make it clear to users that it won't delete databases? I could see it being both scary (you'll delete my data) and counterintuitive (why doesn't my database list match my configuration.nix?) |
Does |
@copumpkin a good point, I was trying to get exactly that message across, but somehow getting it into the parameter name would be even better.. Do I understand correctly that in general this is something that would be merged, if we can figure out those details? |
Is there a reason we still need |
Is this still in progress? Otherwise it should be closed as abandoned. |
@kevincox i watch this issue because i would like to have this feature. i think nobody is working on it. |
Would you be interesting in taking over the PR? Because it appears that the author has left. |
i looked at the current implementation. it is good when you have one database per user but most of the time a user has multiple databases. for manual configuration i use this:
it would be good if that is possible. we may call this option
what do you think? |
The difference between the current |
I made PR #29387 with a different approach to this, hopefully circumventing the issues with this approach. |
My PR was merged now, implementing what this PR was aiming for but simplified to localhost users + Unix socket authentication only. I'd say this can be closed now, if anybody needs more than that they should create a follow-up PR. |
This adds an option databases = [ { name = "mydb", users = [ { username = "myuser"; password = "mysecret"; } ]; } ]; to mysql, which runs mysqladmin create mydb (if the database doesn't exist, if it does exist nothing happens), and then runs mysql to grant access to that db for the given credentials. It only ensures these exist, it never removes or deletes anything.
This is meant to ensure that a certain database and user exist, in contrast to initialDatabases it runs every time mysql is started, not just on first installation.