3366
MySQLERRORNotableData ImportHIGH confidence

Ambiguous field or line terminator in LOAD DATA

Production Risk

Low — LOAD DATA fails; no rows are imported.

How to reproduce
trigger — this will error
trigger — this will error
LOAD DATA INFILE 'data.txt' INTO TABLE t FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n';

expected output

ERROR 3366 (HY000): Field and line terminators are ambiguous.

Fix

Use distinct terminators

Use distinct terminators
LOAD DATA INFILE 'data.csv' INTO TABLE t FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

Why this works

Comma field terminator and newline line terminator are unambiguous.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3366 ER_AMBIGUOUS_FIELD_TERM

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

← All MySQL errors