MySQL configuration: when to use hyphen and when to use underscore
Asked Answered
T

2

28

In MySQL some configuration options use _ and some use -. Is there any way to easily identify when to use one versus the other?.

Terpineol answered 12/10, 2011 at 7:2 Comment(3)
When you are about to change a configuration option, you are bound to have it in front of your eyes already, aren't you? Not sure what sense this would make?Polyethylene
Use underscore ( _ ) in order not to mix up command line flags of MySQL server .Cabot
@Polyethylene at least, if every option follows a unique pattern, it will be helpful, Agree?Terpineol
P
22

No.

It's just one of those things that happen when a team of people design a product.
Different conventions get used leading to inconsistency.

See here: http://dev.mysql.com/doc/refman/5.5/en/mysqld-option-tables.html

And scroll to the options starting with ssl, you'll see what I mean.

Ponderable answered 12/10, 2011 at 7:9 Comment(2)
It's even inconsistent in the doc: At Time Zones we find default-time-zone and default_time_zone. Will it take both? Will it take both in the config file and the command line? Will it warn if not or silently ignore? This is sloppy in so many ways and causes unnecessary confusion. I remember having logged a bug to fix this about 20 years ago. Grrr.Fluctuant
Testing reveals that both underscored and dashed option work when read from config files and that unknown options will cause the server to not start. default_time_zone, default_time-zone, default-time-zone are all recognized. (MariaDB 10.2.13) EXCELLENT!.Fluctuant
B
5

According to the suggestion in the mysql bug report discussing the confusing state of the mysql docs:

  1. The my.cnf and command line options you can use either _ or - within the option name.
  2. Server variables are _ only when working with the MySQL client (modifying from SET for example).

In summary, you can use _ and - interchangeably within a config file.

Bedel answered 6/7, 2019 at 1:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.