1980
MariaDBERRORCommonSyntaxHIGH confidence

Incorrect usage of option

Production Risk

Low — statement is rejected; no data is modified.

What this means

A SQL option or clause was used in a context where it is not permitted. For example, using LOCAL with LOAD DATA when the server or user does not have the required privilege, or using options in the wrong statement context.

Why it happens
  1. 1Using LOCAL INFILE when local_infile is disabled on the server.
  2. 2Placing a statement option in the wrong position in the syntax.
  3. 3Using a clause that is not allowed in a subquery or view context.
How to reproduce
trigger — this will error
trigger — this will error
LOAD DATA LOCAL INFILE '/tmp/data.csv' INTO TABLE t; -- local_infile=OFF

expected output

ERROR 1148 (42000): The used command is not allowed with this MySQL version.

Fix 1

Enable local_infile if using LOAD DATA LOCAL INFILE

Enable local_infile if using LOAD DATA LOCAL INFILE
SET GLOBAL local_infile = ON;
-- And reconnect with --local-infile=1 flag

Why this works

Both the server and client must have local_infile enabled for LOCAL INFILE to work.

Fix 2

Remove the invalid option from the statement

Remove the invalid option from the statement
-- Place options in the correct syntactic position per the MySQL grammar

Why this works

Consult the MySQL reference manual for the correct syntax of the statement.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1980 ER_CANT_USE_OPTION_HERE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors