1064
MariaDBERRORCommonSyntax ErrorHIGH confidence

You have an error in your SQL syntax

What this means

Error 1064 (SQLSTATE 42000) is the generic SQL syntax error. It is returned when the parser cannot interpret the SQL statement. The error message includes the approximate position of the problem and a snippet of the offending text, but the actual mistake is often slightly before that position.

Why it happens
  1. 1Using a reserved word (e.g., ORDER, GROUP, SELECT) as a table or column name without backtick quoting
  2. 2Missing comma between column definitions in CREATE TABLE
  3. 3Using MySQL/MariaDB-specific syntax on a different database engine (or vice versa)
  4. 4A string literal is missing its closing quote
  5. 5Using a feature not available in the connected MariaDB version
How to reproduce

A reserved word is used as a column name without backtick quoting.

trigger — this will error
trigger — this will error
CREATE TABLE orders (
  id INT PRIMARY KEY,
  order INT NOT NULL  -- 'order' is a reserved word
);

expected output

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INT NOT NULL' at line 3

Fix 1

Quote reserved words with backticks

WHEN When a reserved word must be used as an identifier.

Quote reserved words with backticks
CREATE TABLE orders (
  id INT PRIMARY KEY,
  `order` INT NOT NULL
);

Why this works

Backtick quoting (`identifier`) escapes any identifier including reserved words, allowing them to be used as column or table names. This is a MariaDB/MySQL extension; standard SQL uses double quotes.

Fix 2

Rename the identifier to a non-reserved word

WHEN When the schema is still being designed.

Rename the identifier to a non-reserved word
CREATE TABLE orders (
  id INT PRIMARY KEY,
  order_num INT NOT NULL  -- renamed to non-reserved word
);

Why this works

Choosing non-reserved words for identifiers avoids quoting requirements and is more portable across database engines.

What not to do

Concatenate user input directly into SQL strings

String interpolation is the primary vector for SQL injection attacks and also produces 1064 when user input contains quotes or special characters.

Version notes
MariaDB 10.3+

Window functions introduced. Syntax errors in window function clauses produce 1064 with context pointing inside the OVER() clause.

Sources
Official documentation ↗

MariaDB Server error code 1064 / ER_PARSE_ERROR

MariaDB reserved words

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

← All MariaDB errors