SET and SET SESSION

Sets a session variable. The variable’s value remains in effect during an active connection to the database.

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. For session variables with values that need to be propagated to leaf nodes from the aggregator nodes, use a global setting instead.

Syntax

SET [SESSION] variable_name = value;
SET @@SESSION.variable_name = value;
SET PASSWORD FOR 'username'@'host' = PASSWORD('password');

Remarks

  • variable_name is the name of the session variable.

  • The @@SESSION.variable_name syntax is supported for compatibility with other database systems, such as MySQL.

  • This command can be run on a master or child aggregator node to set sync variables, but otherwise must be run on the master aggregator.

  • 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.

  • SET PASSWORD sets the user password. See SET PASSWORD topic for details.

Warning

In SingleStore, SET NAMES, SET CHARSET, and SET CHARACTER SET are valid syntax, but are  non-operational in SingleStore. These commands are included only for MySQL compatibility.

Examples

The following queries set the value of the session variable net_read_timeout to 5000.

SET net_read_timeout = 5000;
SET @@SESSION.net_read_timeout = 5000;

The following query retrieves the value of the session variable net_read_timeout.

SELECT @@net_read_timeout;

Refer to Assigning Expressions to Variables for more examples.

Last modified: May 28, 2025

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK