-
Notifications
You must be signed in to change notification settings - Fork 680
Deprecate reading configuration from my.cnf files #1493
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
Open
rolandwalker
wants to merge
1
commit into
main
Choose a base branch
from
RW/my-dot-cnf-deprecation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+221
−11
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scottnemes
reviewed
Jan 30, 2026
9275bcd to
818cb3a
Compare
scottnemes
reviewed
Jan 30, 2026
scottnemes
reviewed
Jan 30, 2026
scottnemes
reviewed
Jan 30, 2026
5f5598e to
eb66a97
Compare
Contributor
Author
|
Added a |
eb66a97 to
df74b6c
Compare
scottnemes
reviewed
Jan 31, 2026
scottnemes
reviewed
Jan 31, 2026
a69e94c to
d937abf
Compare
scottnemes
approved these changes
Jan 31, 2026
* create corresponding ~/.myclirc configuration options for every option which is currently exclusive to my.cnf, using a new [connection] section, and prepending every option with "default_". * move default_character_set to the new [connection] setting for consistency, but continue to silently read it if present in the [main] section. default_character_set also does not activate any warnings, since it already existed. * create a new config property which does not default to the packaged myclirc. * emit a verbose warning if the user has any _controlling_ configuration option in a my.cnf file. * let corresponding CLI arguments always take precedence over configuration. * to simplify logic, always create a [connection] section in the internal data structure representing ~/.myclirc, and likewise for [client] and [mysqld] in the my.cnf data structure. * finesse some empty controlling configuration: _eg_ an empty setting for default_character_set should default to "utf8mb4". * for consistency, also handle "default_ssl_ca_path" in the [connection] section, though it has no my.cnf equivalent. * add a configuration option my_cnf_transition_done to allow the user to just ignore all of this. The very verbose warnings contain instructions on how to create controlling ~/.myclirc configuration options, the presence of which will suppress the warnings. It is important to note that the warnings only affect users with files at "/etc/my.cnf", "/etc/mysql/my.cnf", "/usr/local/etc/my.cnf", or "~/.my.cnf", with certain options explicitly set, such as "ssl-ca" in the "[client]" section. If the user does not have a my.cnf file, no warnings will be emitted. Note also that since the default myclirc content has been updated to contain controlling configuration options, the warnings will never be emitted for fresh installs, only upgrades (which do not overwrite ~/.myclirc). We should consider a CLI option or configuration setting to unconditionally suppress all such warnings, but the downside of that is continuing to accept a CLI option for compatibility after the deprecation cycle is over. A configuration option could be ignored.
d937abf to
37c9105
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
~/.myclircconfiguration options for every option which is currently exclusive to my.cnf, using a new[connection]section, and prepending every option withdefault_.default_character_setto the new[connection]setting for consistency, but continue to silently read it if present in the[main]section.default_character_setalso does not activate any warnings, since it already existed.[connection]section in the internal data structure representing~/.myclirc, and likewise for [client] and [mysqld] in the my.cnf data structure.default_character_setshould default toutf8mb4.default_ssl_ca_pathin the[connection]section, though it has no my.cnf equivalent.my_cnf_transition_doneto allow the user to just ignore all of this.The very verbose warnings contain instructions on how to create controlling
~/.myclircconfiguration options, the presence of which will suppress the warnings.It is important to note that the warnings only affect users with files at
/etc/my.cnf,/etc/mysql/my.cnf,/usr/local/etc/my.cnf, or~/.my.cnf, with certain options explicitly set, such asssl-cain the[client]section. If the user does not have a my.cnf file, no warnings will be emitted.Note also that since the default myclirc content has been updated to contain controlling configuration options, the warnings will never be emitted for fresh installs, only upgrades (which do not overwrite
~/.myclirc).We should consider a CLI option or configuration setting to unconditionally suppress all such warnings, but the downside of that is continuing to accept the CLI option for compatibility after the deprecation cycle is over. A configuration option could be ignored.EDIT: added a configuration optionmy_cnf_transition_done.Addresses #1490 , which is referenced in the warning message, and should be kept open during the deprecation cycle.
I'm not sure how to write a test for the warning.
Checklist
changelog.md.AUTHORSfile (or it's already there).uv run ruff check && uv run ruff format && uv run mypy --install-types .to lint and format the code.