Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Error 1064: You have an error in your SQL syntax near at line

Error Code
SQLSTATE
Error
Description

1064

42000

ER_PARSE_ERROR

%s near '%s' at line %d

Possible Causes and Solutions

The server returns this error for every statement that it can't parse. The message starts with the text of error 1149, followed by the part of the statement where the parser stopped, and the line number:

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 'SELEC 1' at line 1

To find the mistake:

  • Look at the text after near. The mistake is there or just before it, often in the last word before that text. The server shows at most 80 characters and cuts off the rest with ....

  • near '' means that the statement ended before it was complete, for example SELECT 1 FROM without a table name, or a stored program whose body was cut off at the first ; because the client used ; as the delimiter.

  • The server's line number counts from the start of the statement. When you run a script with the mariadb client, the client adds its own at line with the line of the script where the statement starts. In this example, the statement starts on line 2 of the script, and the typo FRM is on its third line, just before t:

    ERROR 1064 (42000) at line 2: 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 't' at line 3

For the most common causes, such as missing delimiters, reserved words used as identifiers, and syntax that depends on the SQL_MODE, see error 1149.

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?