1231
MariaDBERRORCriticalSyntax / VariablesHIGH confidence
Variable can't be set to the argument value
Production Risk
Low — SET fails safely; current value is unchanged.
What this means
ER_WRONG_VALUE_FOR_VAR (1231, SQLSTATE 42000) is raised when the value provided to SET for a system variable is outside the allowed range or is an invalid option string.
Why it happens
- 1Setting sql_mode to an unrecognized mode string
- 2Setting a numeric variable to a value outside its allowed range
- 3Setting an enum variable to an unrecognized option
How to reproduce
trigger — this will error
trigger — this will error
SET GLOBAL sql_mode = 'INVALID_MODE'; -- ERROR 1231
expected output
ERROR 1231 (42000): Variable 'sql_mode' can't be set to the value of 'INVALID_MODE'
Fix
Use a valid value for the variable
Use a valid value for the variable
SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO';
Why this works
Check MySQL documentation for the list of valid values for each system variable.
Sources
Official documentation ↗
MySQL 8.0 — 1231 ER_WRONG_VALUE_FOR_VAR
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev