1

I want to run this command when I start a MySQL session:

SET SESSION MAX_EXECUTION_TIME = 1000

But I am running this on two different MySQL versions, and one of them doesn't support MAX_EXECUTION_TIME so I get this error:

Unknown system variable 'MAX_EXECUTION_TIME'

I want to do something like

IF MAX_EXECUTION_TIME EXISTS THEN
SET SESSION MAX_EXECUTION_TIME = 1000
END IF

I have tried searching for things like "check if variable exists", "check if system variable exists", and "set system variable only if it exists" but I haven't found anything.

What is the right syntax for this?

Cam
  • 14,930
  • 16
  • 77
  • 128
  • Maybe you can try to SELECT the variable from system table? See [this](https://stackoverflow.com/a/23319195/188331) – Raptor Jul 23 '21 at 01:25

0 Answers0