I'm a nweeby and i really didn't understand what is a Dynamic Variable. I didn't found on documentation. And really what is the concept of Dynamic Vatiables.


1 Answer 1


For the MySQL/MariaDB server "VARIABLES":

  • Dynamic: Yes -- You can SET the variable and immediately see the effect.
  • Dynamic: No -- You need to change the configuration file (my.cnf) and restart the server.

That covers most cases; there are a few that are more complicated. Also, there is some move toward making more of the Variables "dynamic", so you will see differences based on Version of MySQL/MariaDB.

Also, this is usually the history of the values:

  1. When the server starts, the GLOBAL copy of the variables are set from my.cnf or formulas, etc.
  2. When a user connects, the GLOBAL values are copied into SESSION copies.
  3. If dynamic, SET variable_name = value changes the SESSION value.

SET GLOBAL ... will change the default value for all subsequent connections, not your current connection. There are exceptions to this...

Some VARIABLES do not distinguish between SESSION and GLOBAL. For example, since InnoDB's buffer_pool is shared among connections, most settings are GLOBAL; there is no separate value for each SESSION.

(Sorry if I digressed too much; it gets messy. But usually you don't need to worry about these issues.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.