SET Statements •The  @@GLOBAL. ,  @@PERSIST. ,  @@PERSIST_ONLY. ,  @@SESSION. , and  @@  modifiers apply only to system variables. An error occurs for attempts to apply them to user-defined variables, stored procedure or function parameters, or stored program local variables. •Not all system variables can be set to  DEFAULT . In such cases, assigning  DEFAULT  results in an error. •An error occurs for attempts to assign  DEFAULT  to user-defined variables, stored procedure or function parameters, or stored program local variables. Multiple Variable Assignment A  SET  statement can contain multiple variable assignments, separated by commas. This statement assigns values to a user-defined variable and a system variable: SET @x = 1, SESSION sql_mode = ’’; If you set multiple system variables in a single statement, the most recent  GLOBAL ,  PERSIST , PERSIST_ONLY , or  SESSION  keyword in the statement is used for following assignments that have no keyword specified. Examples of multiple-variable assignment: SET GLOBAL sort_buffer_size = 1000000, SESSION sort_buffer_size = 1000000; SET @@GLOBAL.sort_buffer_size = 1000000, @@LOCAL.sort_buffer_size = 1000000; SET GLOBAL max_connections = 1000, sort_buffer_size = 1000000; The  @@GLOBAL. ,  @@PERSIST. ,  @@PERSIST_ONLY. ,  @@SESSION. , and  @@  modifiers apply only to the immediately following system variable, not any remaining system variables. This statement sets the sort_buffer_size  global value to 50000 and the session value to 1000000: SET @@GLOBAL.sort_buffer_size = 50000, sort_buffer_size = 1000000; To refer to the value of a system variable in expressions, use one of the  @@ -modifiers (except  @@PERSIST. and  @@PERSIST_ONLY. , which are not permitted in expressions). For example, you can retrieve system variable values in a  SELECT  statement like this: System Variable References in Expressions SELECT @@GLOBAL.sql_mode, @@SESSION.sql_mode, @@sql_mode; A reference to a system variable in an expression as  @@ var_name  (with  @@  rather than  @@GLOBAL.  or  @@SESSION. ) returns the session value if it exists and the global value otherwise. This differs from  SET @@ var_name  =  expr , which always refers to the session value. Note 13.7.6.2 SET CHARACTER SET Statement SET {CHARACTER SET | CHARSET} {’ charset_name ’ | DEFAULT} This statement maps all strings sent between the server and the current client with the given mapping. SET CHARACTER SET  sets three session system variables:  character_set_client  and character_set_results  are set to the given character set, and  character_set_connection  to the value of  character_set_database . See Section 10.4, “Connection Character Sets and Collations” . charset_name  may be quoted or unquoted. 2910