IT_User
IT_User

Reputation: 779

Creating persistent variable in mysql(5.7)

Good afternoon,

I am trying to create a variable in MySQL (5.7), that will persist through restarts. It appears that user created variables will not give me the ability to accomplish this so I am looking at the global variables. These appear to be built-in to MySQL and I cannot seem to find a way to create a new persistent variable.

How can I create a global/system variable in MySQL (5.7) that will persist through restarts?

Upvotes: 0

Views: 651

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179194

There is no simple way through the SQL interface or configuration to create new system variables -- they are, after all, "system" variables. Any solution to this that comes to mind would be an advanced operation, like one of these:

  • modify the MySQL server source code to create a new system variable

  • modify the MySQL server source code to reintegrate the "deprecated" logic from prior versions, where the old variable and new variable behave the same but the old variable throws a warning when you use it

  • write a MySQL plugin (in C) whose only purpose is to expose a new system variable, basically a dummy variable that doesn't actually do anything, other than having a default value and maybe being (or giving the appearance of being) writable if needed, in order to keep the application happy

Upvotes: 1

Related Questions