System Variable Name vs Option-File Format

I’ve run into this a lot and I would appreciate some clarification. For instance, in the default my.cnf file, there is this option:

default_storage_engine = InnoDB

Then in the config I got from the Percona Wizard, there is this:

default-storage-engine = InnoDB

Now in this instance, the 5.x docs don’t show the first one, but for other names where I run into the same “dashes vs underscores” confusion, it lists the one with dashes as the Option-File Format and the underscores as the System Variable Name. I find them mixed all the time and just don’t understand. I want to be consistent and correct. What is the difference between System Variable Name and Option-File Format in this context, and what should I be using in my.cnf? I could just assume the latter is correct and stick with that but then why is the default file using the former? And in this case, it’s using a format that isn’t even in the docs. If someone could clear this up, I would really appreciate it.

Hi David,

There is already a bug opened for this issue. http://bugs.mysql.com/bug.php?id=55288
There should some specific documentation for that OR they should keep any one out of “_” and “-” but as still it’s in feature requests for Oracle, we can’t do anything for that.
But I would suggest its better to use _ rather then -. Because you can use _ everywhere, including my.cnf and command line . But - is not working with SET like

mysql> SET global default_storage_engine = InnoDB;
Query OK, 0 rows affected (0.01 sec)

mysql> SET global default-storage-engine = InnoDB;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-storage-engine = InnoDB’ at line 1
mysql>

You can use _ with server variables too. Check here comment by “[1 Nov 2008 20:16] Sveta Smirnova” http://bugs.mysql.com/bug.php?id=40368

Excellent, thanks much niljoshi. I hope they get it sorted out but I will go with “_” to keep my work consistent.