Skip to content

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Jan 30, 2026

Description

  • 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 the CLI option for compatibility after the deprecation cycle is over. A configuration option could be ignored. EDIT: added a configuration option my_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

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
  • I ran uv run ruff check && uv run ruff format && uv run mypy --install-types . to lint and format the code.

@rolandwalker rolandwalker self-assigned this Jan 30, 2026
@rolandwalker rolandwalker force-pushed the RW/my-dot-cnf-deprecation branch from 9275bcd to 818cb3a Compare January 30, 2026 18:44
@rolandwalker rolandwalker force-pushed the RW/my-dot-cnf-deprecation branch 5 times, most recently from 5f5598e to eb66a97 Compare January 31, 2026 10:59
@rolandwalker
Copy link
Contributor Author

Added a ~/.myclirc configuration option my_cnf_transition_done which shortcuts the entire check if True. In the future we can just ignore it.

@rolandwalker rolandwalker force-pushed the RW/my-dot-cnf-deprecation branch from eb66a97 to df74b6c Compare January 31, 2026 11:01
@rolandwalker rolandwalker force-pushed the RW/my-dot-cnf-deprecation branch 3 times, most recently from a69e94c to d937abf Compare January 31, 2026 19:29
 * 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.
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

Successfully merging this pull request may close these issues.

3 participants