Does mysql configuration options accepts - instead of _? Mysql 5.7 Documentation mentions that innodb_buffer_pool_instances can be set in /etc/mysql/mysqld.conf.d/mysqld.cnf as follows:

[mysqld]
innodb_buffer_pool_instances    = 16


However, an existing setup uses mysql configuration as follows (passed in /etc/mysql/mysqld.conf.d/mysqld.cnf):

[mysqld]
innodb-buffer-pool-instances    = 16


And it seems to be working.

Does mysql configuration options accept - instead of _ in variables or am I missing something here?
https://dev.mysql.com/doc/refman/8.0/en/command-line-options.html says:


  Within option names, dash (-) and underscore (_) may be used
  interchangeably. For example, --skip-grant-tables and
  --skip_grant_tables are equivalent. (However, the leading dashes cannot be given as underscores.)


This applies to options when you use them in option files, as well as command-line flags.

However, when using option variables in SQL queries, like in SET GLOBAL read_only=ON, you must use underscores only. Even putting the variable in back-ticks doesn't allow you to use hyphens.

mysql&gt; set global `read_only`=ON;
Query OK, 0 rows affected (0.00 sec)

mysql&gt; set global `read-only`=ON;
ERROR 1193 (HY000): Unknown system variable 'read-only'

mysql&gt; select @@`read_only`;
+---------------+
| @@`read_only` |
+---------------+
|             1 |
+---------------+
1 row in set (0.01 sec)

mysql&gt; select @@`read-only`;
ERROR 1193 (HY000): Unknown system variable 'read-only'