How to Fix the MySQL Error 1064

When there is a syntax mistake in the SQL statement, MySQL Error Code 1064 is displayed. This indicates that MySQL does not recognise the command and issues an error. This post will show you how to work around the  MySQL Error 1064.

Understanding the MySQL Error 1064 message

In MySQL, tracing down and fixing query or command problems might take a long time, especially for beginners. Before attempting to fix the error, you must first understand how MySQL generates the error message. The example below demonstrates how to interpret MySQL's error 1064.

Example:

Returns message:

Error Code: 1064. 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 'from Person' at line 2.
  • In an error message, the quotation denotes the first character of the query that MySQL is unable to perform. The quotation begins at 'from Person' in the example above. Because there is a comma before 'from Person' MySQL expects another column name in the SELECT clause rather than the keyword 'from’ in the command.'
  • Look for the word… near '...' in the error message to see where the error started. The error's position is indicated by the first word (token) in the quotes and the last word in the quotes. Example: near 'from Person'
  • If the error message contains ... near ‘ ‘  but nothing between the quotes, MySQL does not identify where the query statement starts and ends. It could indicate that the query has unbalanced quotes (' or “), or that the parentheses are not balanced, or that the query is not properly terminated.

MySQL Reference Manual 

Check the MySQL Reference Manual for updated features, commands, and obsolete commands that could be contributing to MySQL Error 1064 if you're working on a new database version. Access the MySQL Reference Handbook; in the General Information portion of each version reference manual, you'll find the What's New section. It informs you about new features, deprecated commands, and other database-related information.

Using tools to validate MySQL command syntax

If you are new to MySQL commands then make use of platforms like EverSQL or MySQL Syntax Checker to validate your MySQL query. Copy and paste your code into the platform and it automatically validates your query.

More Information

For more information please visit:

Get MySQL Hosting

Article Details

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.