3112
MySQLERRORNotableServer AdministrationHIGH confidence
Variable cannot be set as command-line argument at server start
Production Risk
High — the MySQL server may fail to start.
What this means
The variable specified as a command-line or configuration file argument at server start is not valid in that context.
Why it happens
- 1Passing a session-only variable as a command-line argument to mysqld.
- 2Setting a variable in my.cnf that is not valid as a startup option.
How to reproduce
trigger — this will error
trigger — this will error
-- mysqld --autocommit=0 (autocommit is a session variable, not a startup option)
expected output
ERROR 3112 (HY000): Variable 'autocommit' cannot be set to the value of 1 at start as a command line argument.
Fix 1
Remove the invalid startup option from my.cnf
Remove the invalid startup option from my.cnf
-- Remove the unsupported option from /etc/mysql/my.cnf or my.ini
Why this works
Prevents the server from failing to start due to an invalid option.
Fix 2
Use SET SESSION or SET GLOBAL at runtime instead
Use SET SESSION or SET GLOBAL at runtime instead
SET SESSION autocommit = 0;
Why this works
Sets session-only variables at runtime rather than at server startup.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3112 ER_CANT_SET_VAR_AT_START_AS_COMMAND_LINE_ARG2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev