Reputation: 991
Can I simply toggle a (GLOBAL) variable's state with a query? That is, if it's 'ON'
make it 'OFF'
and if it's 'OFF'
make it 'ON'
.
I tried this:
SET GLOBAL general_log = IF(general_log = 'ON', 'OFF', 'ON')
but that produces an error.
Upvotes: 3
Views: 206
Reputation: 425083
Try this:
set global general_log = if (@@general_log, 'OFF', 'ON')
Note that @@general_log
is either 0
or 1
(it's a bit
type) and in MySQL these values are false
and true
respectively.
Upvotes: 3