SET and SET SESSION
On this page
Sets session variables.
Warning
SingleStore recommends using the SET SESSION statement for session variables that are only referenced by the aggregator nodes on which the variable is set.
Syntax
SET { [SESSION] variable_name } = value;
SET @@SESSION.variable_name = value;
SET {CHARACTER SET 'charset_name'};
SET PASSWORD FOR 'username'@'host' = PASSWORD('password');
Remarks
-
variable_
is the name of the session variable.name -
The
@@SESSION.
syntax is supported for compatibility with some other database systems.variable_ name This is similar to MySQL behavior. -
This command can be run on a child or master aggregator node to set sync variables, but must be run on the master aggregator otherwise.
-
See the engine variables overview for information about other ways to set variables.
-
The
SESSION
keyword is optional.Including it does not change this command’s behavior. -
charset_
sets session system variables character_name set_ client and character_ set_ results to the given character set, and character_ set_ connection to the value of character_ set_ server. It may be quoted or unquoted. The default character set mapping can be restored by using value DEFAULT
. -
SET PASSWORD
sets the user password.See SET PASSWORD topic for details. -
SET NAMES
is non-operational in SingleStore and is included only for MySQL compatibility.
Examples
Set Session Variable
The following example sets the session variable net_
and retrieves its value.
SET net_read_timeout = 5000;orSET @@SESSION.net_read_timeout = 5000;
Retrieve the session variable’s value:
SELECT @@net_read_timeout;
Set Character Set
The following example sets the character set of the client to utf8
.
SET CHARACTER SET 'utf8';
Query OK, 0 rows affected (13 ms)
Related Topics
Last modified: August 30, 2024