Bug #64195 init-connect not listed as an option
Submitted: 1 Feb 2012 15:50 Modified: 7 Mar 2012 3:17
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:any OS:Any
Assigned to: Paul DuBois CPU Architecture:Any
Tags: qc

[1 Feb 2012 15:50] Peter Laursen
Description:
init_connect is listed as a variable (http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_init_connect) but not as an option (http://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html).

This is inconsistent with http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_init_connect  "The init_connect variable can also be set on the command line or in an option file.  

How to repeat:
see above

Suggested fix:
add to http://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html
[1 Feb 2012 15:57] Peter Laursen
changing category to docs@cats
[1 Feb 2012 16:14] Valeriy Kravchuk
Sorry, but init_connect is mysqld's (MySQL server's) option, not mysql's (MySQL command line client's) option, isn't it? 

So, why should it be mentioned on that page you mentioned?
[1 Feb 2012 16:18] Peter Laursen
Good point.  Google fooled my again.

But it is not here either where it should be: http://dev.mysql.com/doc/refman/5.5/en/server-options.html ('Server Command Options').
[1 Feb 2012 16:29] Valeriy Kravchuk
OK, http://dev.mysql.com/doc/refman/5.5/en/server-options.html should be fixed to include description for this command line option it seems...
[2 Feb 2012 14:35] Paul DuBois
"
This is inconsistent with
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_init_connect
"The init_connect variable can also be set on the command line or in an
option file.  
"

Not really. Many system variables can be set at server startup, but they're still system variables.
[2 Feb 2012 15:14] Peter Laursen
OK .. but what is then the exact definitions of options and variables respectively? 

What variables can be specified on commandline/options file that do not have a corresponding option (similar to option/variable default-storage-engine/default_storage_engine?

Besides init_connect accepts the spelling form "init-connect" normally used for options and not for variables (hyphen used for options, underscores for variables).  If I have in configuration "init-connect = 'set @peter = 7'" and connect as a non-SUPER user @peter was assigned "7". 

To me it behaves totally as an option and also accepts the (hyphen-)syntax used for options.  But it is not a big deal of course.
[7 Mar 2012 3:17] Paul DuBois
"OK .. but what is then the exact definitions of options and variables respectively? "

The server has an array of options in mysqld.cc and a set of system variable definitions in sys_vars.cc. So they're not equivalent, although there is overlap. We can't really treat them as the same because there is not perfect correspondence.

At startup, most system variables can be treated like options, and dash and underscore are both understood the same way, even though options have dashes and system variable names have underscores.

See: http://dev.mysql.com/doc/refman/5.5/en/program-variables.html
For example:

"
If you like, underscores in a variable name can be specified as dashes. The following option groups are equivalent. Both set the size of the server's key buffer to 512MB:

[mysqld]
key_buffer_size=512M

[mysqld]
key-buffer-size=512M
"