MySQL error 1064 indicates a syntax error in your SQL query. This happens when MySQL encounters mistyped commands, reserved words used as identifiers, incorrect punctuation, or deprecated syntax that it cannot parse.
MySQL error 1064 (ER_PARSE_ERROR) is thrown when the MySQL parser encounters an SQL statement it cannot understand. This is not a runtime error—it occurs at the parsing stage before any query execution. The error means your SQL syntax violates MySQL rules or contains commands MySQL does not recognize. Common culprits include typos in keywords, reserved words used without backticks, missing or extra punctuation, and deprecated commands from older MySQL versions.
MySQL provides helpful error output that includes the location of the syntax error. The message format is:
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 '<problem area>' at line XThe text shown after "near" pinpoints the problematic area. Focus your search on that location and surrounding code.
Review your query for common misspellings:
-- Wrong (typo)
SLECT * FROM users;
-- Correct
SELECT * FROM users;Also verify keywords like INSERT, UPDATE, DELETE, WHERE, FROM, JOIN, GROUP BY, ORDER BY are spelled correctly.
If you use MySQL reserved words (SELECT, FROM, WHERE, ORDER, GROUP, etc.) as table or column names, wrap them in backticks:
-- Wrong (reserved word without backticks)
SELECT order FROM products;
-- Correct
SELECT `order` FROM products;Do NOT use single (') or double (") quotes for identifiers—those are for string literals only.
Check that:
- All opening parentheses have matching closing ones
- String values are enclosed in single quotes (e.g., 'John')
- Column lists have commas between items
- All semicolons are at the end of complete statements
-- Wrong (missing closing parenthesis)
SELECT * FROM users WHERE id IN (1, 2, 3;
-- Correct
SELECT * FROM users WHERE id IN (1, 2, 3);
-- Wrong (unquoted string)
SELECT * FROM users WHERE name = John;
-- Correct
SELECT * FROM users WHERE name = 'John';If migrating from MySQL 5.0 or earlier, update deprecated commands:
-- Old (deprecated in MySQL 4.1, removed in 5.1)
CREATE TABLE users (id INT) TYPE=InnoDB;
-- New
CREATE TABLE users (id INT) ENGINE=InnoDB;Check the MySQL Reference Manual for your version to identify deprecated features.
Tools like MySQL Workbench (official tool from MySQL) provide real-time syntax checking and highlighting. They catch 1064 errors before you execute:
- MySQL Workbench: Free, official, includes SQL editor with error highlighting
- SQL Fiddle: Web-based SQL testing tool
- Your IDE: Many code editors have SQL extensions with syntax validation
Copy your query into one of these tools to get instant feedback.
Syntax varies between MySQL versions. Verify your MySQL version:
SELECT VERSION();Then check the MySQL Reference Manual for your version. Features added in MySQL 8.0 will not work on 5.7. If you're using syntax from a newer version on an older server, you'll see error 1064.
In generated SQL (from ORMs, query builders, or templating), error 1064 often reveals issues in the generation logic. Check that your ORM is escaping identifiers correctly and using the right syntax for your MySQL version. For stored procedures and triggers, syntax errors prevent creation; validate the entire block before running. Character set and collation mismatches can sometimes appear as syntax errors in MySQL 5.7—ensure your connection charset matches the database.
EE_WRITE (3): Error writing file
How to fix "EE_WRITE (3): Error writing file" in MySQL
CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters
How to fix "CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters" in MySQL
CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed
How to fix "CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed" in MySQL
ERROR 1146: Table 'database.table' doesn't exist
How to fix "ERROR 1146: Table doesn't exist" in MySQL
ERROR 1040: Too many connections
How to fix "ERROR 1040: Too many connections" in MySQL