Bug #52565 _ and - interchangeable for variables/options, though not everywhere
Submitted: 2 Apr 2010 22:36 Modified: 6 Apr 2010 4:40
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:5.0+ OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[2 Apr 2010 22:36] Roel Van de Paar
Description:
An example:

http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_log-warnings

Lists option as "log-warnings". Setting the same in my.ini works fine both with a - and an _ :

[mysqld]
log-warnings=2

or

log_warnings=2

Both work. 

Yet:

mysql> show global variables like 'log_warnings';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_warnings  | 2     |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show global variables like 'log-warnings';
Empty set (0.00 sec)

This is even more confusing since the manual specifies it with a - instead of an _.

How to repeat:
As per the above.

Suggested fix:
Allow - and _ everywhere, starting with SHOW GLOBAL VARIABLES LIKE.
[5 Apr 2010 20:21] Roel Van de Paar
The issue is this:

mysql> show global variables like 'log-warnings';
Empty set (0.00 sec)
[6 Apr 2010 4:40] Valeriy Kravchuk
I can agree with this as a feature request for SHOW VARIABLES to "normalize" variable name and check for '_' even when user asks for '-'. Still, there is a workaround:

mysql> show variables like 'log%warnings%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_warnings  | 1     |
+---------------+-------+
1 row in set (0.00 sec)