1233
MySQLERRORCriticalSyntax / VariablesHIGH confidence
Variable can only be set, not read
Production Risk
Low — query fails; no data affected.
What this means
ER_VAR_CANT_BE_READ (1233, SQLSTATE HY000) is raised when a SELECT or SHOW statement attempts to read a system variable that is write-only.
Why it happens
- 1Attempting to SELECT @@write_only_variable
- 2Using SHOW VARIABLES to retrieve a write-only variable
How to reproduce
trigger — this will error
trigger — this will error
SELECT @@write_only_var; -- ERROR 1233
expected output
ERROR 1233 (HY000): Variable 'write_only_var' is a write only variable
Fix
Use the variable for SET only
Use the variable for SET only
-- This variable is for setting only; do not attempt to read it SET SESSION write_only_var = 'value';
Why this works
Some MySQL variables are designed as write-only for security or implementation reasons.
Sources
Official documentation ↗
MySQL 8.0 — 1233 ER_VAR_CANT_BE_READ
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev