Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Sets session variables. The variable’s value is effective for the user’s current connection to the node, until the node is restarted.
SET { [SESSION] variable_name } = value;
SET [SESSION] @@variable_name = value;
SET {CHARACTER SET 'charset_name' | NAMES {'charset_name'}};
SET PASSWORD FOR 'username'@'host' = PASSWORD('password');
variable_name
is the name of the session variable.@@variable_name
syntax is supported for compatibility with some other database systems. This is similar to MySQL behavior.SESSION
keyword is optional. Including it does not change this command’s behavior.charset_name
sets session system variables character_set_client and character_set_results to the given character set, and character_set_connection to the value of character_set_database. It may be quoted or unquoted. The default character set mapping can be restored by using value DEFAULT
.NAMES
sets the session system variables: character_set_client, character_set_connection, and character_set_results to the given character set. charset_name
may be quoted or unquoted. The default mapping can be restored by using value DEFAULT
.SET PASSWORD
sets the user password. See SET PASSWORD topic for details.Set Session Variable
The following example sets the session variable net_read_timeout
and retrieves its value.
SET net_read_timeout = 5000;
Retrieve the session variable’s value:
SELECT @@net_read_timeout;
Set Character Set
SET CHARACTER SET
is similar to SET NAMES
. The following example sets the character set of the client to utf8
.
SET CHARACTER SET 'utf8';
****
Query OK, 0 rows affected (13 ms)
SET NAMES 'utf8';
****
Query OK, 0 rows affected (25 ms)