18.9 Session Variables
Session variables remain in effect during the session until the variable changes or the session ends. The change has no effect on other sessions. For new connections, a session variable value is initialized with the corresponding global system variable value. Many of the following session variables are also available as user configurable variables. See: User-Configurable System Variables.
To assign a value to a session variable, precede the variable
name with the SESSION
or
LOCAL
keyword, or with the
@@SESSION.
, @@LOCAL.
, or
@@
qualifier, or with no keyword or modifier.
For example:
mysql> SET SESSION sql_mode = 'TRADITIONAL';
mysql> SET LOCAL sql_mode = 'TRADITIONAL';
mysql> SET @@SESSION.sql_mode = 'TRADITIONAL';
mysql> SET @@LOCAL.sql_mode = 'TRADITIONAL';
mysql> SET @@sql_mode = 'TRADITIONAL';
mysql> SET sql_mode = 'TRADITIONAL';
Table 18-18 User Settable Session Variables
Parent topic: Configuration