1149
MySQLERRORCommonQueryHIGH confidence

SQL syntax error (detailed variant)

Production Risk

Low — query is rejected; no data is affected.

What this means

ER_SYNTAX_ERROR (1149, SQLSTATE 42000) is a syntax error variant similar to 1064 but raised in specific parser contexts. The error message includes the position in the query where parsing failed.

Why it happens
  1. 1Invalid SQL syntax in a specific parser context
  2. 2Using SQL syntax from a different database system
  3. 3Unmatched parentheses, quotes, or keywords
How to reproduce
trigger — this will error
trigger — this will error
SELECT * FORM users;

expected output

ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM users' at line 1

Fix

Review and fix the SQL syntax at the indicated position

WHEN Always — the "near" clause identifies the problem location.

Review and fix the SQL syntax at the indicated position
-- Correct the syntax:
SELECT * FROM users;

Why this works

The "near" clause in the error message points to the token where MySQL's parser lost track; fix the SQL from that point backward.

What not to do

Ignore syntax errors as transient

Syntax errors are deterministic; the same query will always fail with the same error. Fix the SQL.

Sources
Official documentation ↗

MySQL 8.0 — 1149 ER_SYNTAX_ERROR

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

← All MySQL errors