If no modifier is present, SET changes the session variable. If the session variable does not exist, an error occurs even if the corresponding global variable exists.
With the GLOBAL modifier, SHOW VARIABLES displays the values that are used for new connections to
MySQL. In MySQL 5.6, if a variable has no global value, no value is displayed. With SESSION, SHOW
VARIABLES displays the values that are in effect for the current connection. If no modifier is present, the default is SESSION. LOCAL is a synonym for SESSION.
When you refer to a system variable in an expression as @@var_name (that is, when you do not
specify @@global. or @@session.), MySQL returns the session value if it exists and the global value otherwise. (This differs from SET @@var_name = value, which always refers to the session value.)