The scope of the mysql set keyword.

SET var_name = value
enables you to assign values to variables that affect the operation of the server or clients.
Many system variables are dynamic and can be changed at runtime by using the SET statement.

SET var_name = value
enables you to assign values to variables that affect server or client operations. Many system variables are dynamic and can be changed at run time using set statements

so does the system variable set by set remain in effect while mysql is running?
seems to be the current session, during its effective period, so how is session defined?
(the definition of duration is not found in the official manual 18.2.1 MySQL Shell Sessions)
will it be overridden by the settings in my.ini only after restarting mysql?

Mar.23,2021

  1. the validity period of session is that connection,connection is disconnected and session is terminated.
  2. set defaults to the session variable. As mentioned above, as long as connection disconnects the session variable, it disappears, and after the next reconnection, the session variable returns to its initial value. Of course, if you don't want the variable to fail, you can modify the global variable with the global parameter when you set.

connection on the command line is the period from mysql to exit. Then the executed sql file belongs to the current session, and will not start another session.

Menu