{"id":2600,"date":"2013-04-10T16:40:22","date_gmt":"2013-04-10T16:40:22","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2013\/04\/10\/error-1064\/"},"modified":"2025-12-31T15:05:12","modified_gmt":"2025-12-31T20:05:12","slug":"error-1064","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/","title":{"rendered":"MySQL Error 1064: You Have an Error in Your SQL Syntax"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured-1024x538.png\" alt=\"featured image with text MySQL 1064 error troubleshoot and fix SQL syntax error\" class=\"wp-image-129242\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p>MySQL Error 1064 appears when the database engine cannot parse your SQL statement. The error message typically reads: \u201cYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \u2018\u2026\u2019 at line X.\u201d<\/p>\n\n\n\n<p>The good news: this error always points to a specific location in your query. The text after \u201cnear\u201d shows exactly where MySQL stopped understanding your command, and the line number tells you where to look.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Read the Error Message<\/h2>\n\n\n\n<p>Before fixing anything, extract the diagnostic information MySQL provides. A typical 1064 error looks like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual \nthat corresponds to your MySQL server version for the right syntax to use \nnear 'FORM users WHERE id = 1' at line 1<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">ERROR <\/span><span style=\"color: #79B8FF\">1064<\/span><span style=\"color: #E1E4E8\"> (<\/span><span style=\"color: #79B8FF\">42000<\/span><span style=\"color: #E1E4E8\">): You have an error <\/span><span style=\"color: #F97583\">in<\/span><span style=\"color: #E1E4E8\"> your <\/span><span style=\"color: #F97583\">SQL<\/span><span style=\"color: #E1E4E8\"> syntax; <\/span><span style=\"color: #F97583\">check<\/span><span style=\"color: #E1E4E8\"> the <\/span><span style=\"color: #F97583\">manual<\/span><span style=\"color: #E1E4E8\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">that corresponds <\/span><span style=\"color: #F97583\">to<\/span><span style=\"color: #E1E4E8\"> your MySQL <\/span><span style=\"color: #F97583\">server<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">version<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">for<\/span><span style=\"color: #E1E4E8\"> the right syntax <\/span><span style=\"color: #F97583\">to<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">use<\/span><span style=\"color: #E1E4E8\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">near <\/span><span style=\"color: #9ECBFF\">'FORM users WHERE id = 1'<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">at<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">line<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">1<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Three pieces of information matter here:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The snippet after \u201cnear\u201d<\/strong> shows the first characters MySQL could not interpret. In this example, \u201cFORM\u201d is the problem; it should be \u201cFROM.\u201d<\/li>\n\n\n\n<li><strong>The line number<\/strong> indicates where the parser stopped. In multi-line queries, this narrows your search.<\/li>\n\n\n\n<li><strong>The 42000 code<\/strong> is the SQLSTATE value, which confirms this is a syntax-class error.<\/li>\n<\/ul>\n\n\n\n<p>If your query spans dozens of lines, copy it into a text editor with line numbers before troubleshooting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Causes of MySQL Error 1064<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Misspelled Commands<\/h3>\n\n\n\n<p>Typos are the most frequent cause of syntax errors. MySQL commands must match exactly. Typos like \u201cSELCT,\u201d \u201cUDPATE,\u201d and \u201cFORM\u201d all trigger Error 1064.<\/p>\n\n\n\n<p><strong>Broken query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>UDPATE customers SET status = 'active' WHERE id = 5;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">UDPATE customers <\/span><span style=\"color: #F97583\">SET<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">status<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'active'<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> id <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">5<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Working query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>UPDATE customers SET status = 'active' WHERE id = 5;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">UPDATE<\/span><span style=\"color: #E1E4E8\"> customers <\/span><span style=\"color: #F97583\">SET<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">status<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'active'<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> id <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">5<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The fix is straightforward, but these typos hide easily in longer queries. Reading your SQL aloud or using a syntax checker catches mistakes your eyes skip over.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reserved Words as Identifiers<\/h3>\n\n\n\n<p>MySQL reserves certain words for specific functions. In the <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/keywords.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">MySQL 8.0 Reference Manual<\/a>, reserved words are permitted as identifiers if you quote them using backticks.<\/p>\n\n\n\n<p><strong>Broken query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE order (id INT, date DATE, total DECIMAL(10,2));<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">order<\/span><span style=\"color: #E1E4E8\"> (id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #F97583\">date<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">DATE<\/span><span style=\"color: #E1E4E8\">, total <\/span><span style=\"color: #F97583\">DECIMAL<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">10<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>MySQL interprets \u201corder\u201d as the <code>ORDER BY<\/code> clause, not a table name.<\/p>\n\n\n\n<p><strong>Working query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE `order` (id INT, `date` DATE, total DECIMAL(10,2));<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> `<\/span><span style=\"color: #B392F0\">order<\/span><span style=\"color: #E1E4E8\">` (id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">`date`<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">DATE<\/span><span style=\"color: #E1E4E8\">, total <\/span><span style=\"color: #F97583\">DECIMAL<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">10<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Backticks tell MySQL to treat these words as identifiers rather than commands. Both \u201corder\u201d and \u201cdate\u201d are reserved words, so both need quoting.<\/p>\n\n\n\n<p>You can check whether a word is reserved by querying the <code>INFORMATION_SCHEMA<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM INFORMATION_SCHEMA.KEYWORDS WHERE WORD = 'ORDER';<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">INFORMATION_SCHEMA<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">KEYWORDS<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> WORD <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'ORDER'<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The <code>KEYWORDS<\/code> table lists the words considered keywords by MySQL and, for each one, indicates whether it is reserved.<\/p>\n\n\n\n<p>A better long-term solution: avoid reserved words entirely. Name the table \u201corders\u201d or \u201ccustomer_orders\u201d instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Missing or Extra Punctuation<\/h3>\n\n\n\n<p>SQL syntax requires specific punctuation in specific places. Missing commas between column definitions, unmatched parentheses, or absent semicolons all produce Error 1064.<\/p>\n\n\n\n<p><strong>Broken query (missing comma):<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE products (\n    id INT AUTO_INCREMENT PRIMARY KEY\n    name VARCHAR(100),\n    price DECIMAL(10,2)\n);<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">products<\/span><span style=\"color: #E1E4E8\"> (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\"> AUTO_INCREMENT <\/span><span style=\"color: #F97583\">PRIMARY KEY<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">VARCHAR<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">100<\/span><span style=\"color: #E1E4E8\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    price <\/span><span style=\"color: #F97583\">DECIMAL<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">10<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">);<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Working query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE products (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(100),\n    price DECIMAL(10,2)\n);<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">products<\/span><span style=\"color: #E1E4E8\"> (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\"> AUTO_INCREMENT <\/span><span style=\"color: #F97583\">PRIMARY KEY<\/span><span style=\"color: #E1E4E8\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">VARCHAR<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">100<\/span><span style=\"color: #E1E4E8\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    price <\/span><span style=\"color: #F97583\">DECIMAL<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">10<\/span><span style=\"color: #E1E4E8\">,<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">);<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>That surprises a lot of developers on their first encounter. The error message points to \u201cname VARCHAR(100)\u201d because MySQL expected a comma or closing parenthesis before it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Mismatched Quotes<\/h3>\n\n\n\n<p>String values require quotes, and the opening and closing quotes must match. Single quotes (<code>'<\/code>) enclose string literals in MySQL. Backticks (<code>`<\/code>) surround identifiers. Double quotes (<code>\"<\/code>) behave differently depending on the SQL mode.<\/p>\n\n\n\n<p><strong>Broken query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE name = 'O'Brien';<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'O'<\/span><span style=\"color: #E1E4E8\">Brien<\/span><span style=\"color: #9ECBFF\">';<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The apostrophe in \u201cO\u2019Brien\u201d terminates the string early.<\/p>\n\n\n\n<p><strong>Working query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE name = 'O''Brien';<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'O''Brien'<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Doubling the single quote escapes it. Alternatively, use a backslash: <code>'O\\'Brien'<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE name = 'O\\'Brien';<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'O\\'<\/span><span style=\"color: #E1E4E8\">Brien<\/span><span style=\"color: #9ECBFF\">';<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Missing Data in Variables<\/h3>\n\n\n\n<p>When application code builds SQL queries dynamically, empty variables create incomplete statements.<\/p>\n\n\n\n<p><strong>Query with missing variable:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE user_id = ;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> user_id <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> ;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If your application substitutes a variable for the user ID and that variable is empty, the query reaches MySQL with nothing after the equals sign. MySQL cannot parse an incomplete comparison.<\/p>\n\n\n\n<p><strong>What your application should generate:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE user_id = 42;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> user_id <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">42<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Check your application logs and variable assignments. If you use prepared statements, which you should for security reasons, the database driver typically catches these issues before they become syntax errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Obsolete Commands<\/h3>\n\n\n\n<p>MySQL removes deprecated commands after a transition period. The most common example is the <code>TYPE<\/code> keyword for storage engines.<\/p>\n\n\n\n<p><strong>Outdated query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE archive (id INT) TYPE = InnoDB;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">archive<\/span><span style=\"color: #E1E4E8\"> (id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">TYPE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> InnoDB;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The <code>TYPE<\/code> keyword was deprecated in MySQL 4.1 and removed entirely in MySQL 5.1.<\/p>\n\n\n\n<p><strong>Current query:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>CREATE TABLE archive (id INT) ENGINE = InnoDB;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">TABLE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">archive<\/span><span style=\"color: #E1E4E8\"> (id <\/span><span style=\"color: #F97583\">INT<\/span><span style=\"color: #E1E4E8\">) ENGINE <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> InnoDB;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This issue frequently appears when importing database dumps created on older MySQL versions. If you are migrating from MySQL 5.x to 8.x, you can encounter problems when you attempt to replicate from an older source to a newer replica and you make use of identifiers on the source that are reserved words in the newer MySQL version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Version Incompatibility<\/h3>\n\n\n\n<p>MySQL adds new reserved words with each major release. A column named \u201crank\u201d works fine in MySQL 5.7 but fails in MySQL 8.0, where RANK became a reserved word for window functions.<\/p>\n\n\n\n<p>Check your MySQL version:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT VERSION();<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">VERSION<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Then compare your identifiers against the <a href=\"https:\/\/dev.mysql.com\/doc\/mysqld-version-reference\/en\/keywords.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">reserved words list for your version<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Character Encoding Issues<\/h3>\n\n\n\n<p>Copy-pasting SQL from word processors or websites sometimes introduces invisible characters or \u201csmart quotes\u201d that look correct but are not ASCII.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE status = \u2018active\u2019;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">status<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> \u2018active\u2019;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Those curly quotes render beautifully in documentation but MySQL does not recognize them. Replace them with straight single quotes:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>SELECT * FROM users WHERE status = 'active';<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users <\/span><span style=\"color: #F97583\">WHERE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">status<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'active'<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If you suspect encoding problems, paste your query into a plain text editor or hex viewer to expose hidden characters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Fix MySQL Error 1064<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Locate the Error Position<\/h3>\n\n\n\n<p>Find the snippet shown after \u201cnear\u201d in the error message. That text marks where parsing failed. The actual mistake usually appears just before that point.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Check for Typos<\/h3>\n\n\n\n<p>Compare each keyword in your query against the official syntax. Spell out <code>SELECT<\/code>, <code>FROM<\/code>, <code>WHERE<\/code>, <code>UPDATE<\/code>, <code>INSERT<\/code>, <code>DELETE<\/code>, and other commands letter by letter if needed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Verify Punctuation<\/h3>\n\n\n\n<p>Confirm that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Every opening parenthesis has a closing match<\/li>\n\n\n\n<li>Commas separate column definitions and value lists<\/li>\n\n\n\n<li>String literals use straight single quotes<\/li>\n\n\n\n<li>Semicolons terminate statements, especially in multi-statement scripts<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Escape Reserved Words<\/h3>\n\n\n\n<p>If your table or column names match MySQL reserved words, wrap them in backticks. Better yet, rename them to avoid the conflict permanently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Validate Dynamic Queries<\/h3>\n\n\n\n<p>Print the final SQL string your application generates before execution. Variables that appear correct in your code may produce invalid SQL after concatenation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Test with Simpler Queries<\/h3>\n\n\n\n<p>Break complex queries into smaller pieces. Execute each piece separately until you find the segment that fails. This isolates the problem faster than staring at 50 lines of SQL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Online Syntax Checkers<\/h2>\n\n\n\n<p>Running your query through a syntax validator before execution saves time, especially for long or complex statements. These tools parse SQL without connecting to a database:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.eversql.com\/sql-syntax-check-validator\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">EverSQL SQL Validator<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/extendsclass.com\/sql-validator.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">ExtendsClass SQL Validator<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.beekeeperstudio.io\/tools\/sql-syntax-checker\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Beekeeper Studio Syntax Checker<\/a><\/li>\n<\/ul>\n\n\n\n<p>The validation rules adjust based on the dialect you select from the dropdown menu. Select MySQL specifically rather than generic SQL for accurate results.<\/p>\n\n\n\n<p>phpMyAdmin also highlights syntax errors before execution if you enable the SQL validator feature.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Preventing Error 1064<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Use Prepared Statements<\/h3>\n\n\n\n<p>Prepared statements separate SQL structure from data values. This eliminates a whole class of syntax errors from variable interpolation while also protecting against SQL injection:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$stmt = $pdo-&gt;prepare(\"SELECT * FROM users WHERE email = ?\");\n$stmt-&gt;execute([$email]);<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">$stmt <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> $pdo<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #E1E4E8\">prepare(<\/span><span style=\"color: #9ECBFF\">\"SELECT * FROM users WHERE email = ?\"<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">$stmt<\/span><span style=\"color: #F97583\">-&gt;execute<\/span><span style=\"color: #E1E4E8\">([$email]);<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Adopt Naming Conventions<\/h3>\n\n\n\n<p>Prefix table names with a category identifier (e.g., \u201ctbl_order\u201d or \u201capp_order\u201d) to avoid collisions with reserved words. Use snake_case for multi-word names: \u201cuser_accounts\u201d rather than \u201cUserAccounts\u201d or \u201cuser-accounts.\u201d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Version Your Schema Scripts<\/h3>\n\n\n\n<p>When upgrading MySQL, test your existing queries against the new version in a development environment first. Reserved word conflicts and deprecated syntax surface quickly in testing but cause production outages if discovered after migration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Keep Database Tools Updated<\/h3>\n\n\n\n<p>Database management tools like <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/manage-databases-cpanel-phpmyadmin\/\">phpMyAdmin<\/a>, <a href=\"https:\/\/www.mysql.com\/products\/workbench\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">MySQL Workbench<\/a>, and <a href=\"https:\/\/dbeaver.io\/download\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">DBeaver<\/a> include updated syntax highlighting and autocompletion that reflect current MySQL versions. Outdated tools may suggest deprecated syntax.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Special Cases<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Importing Database Dumps<\/h3>\n\n\n\n<p>Large SQL dump files often contain multiple statements and comments. A single syntax error halts the entire import. If you encounter Error 1064 during import:<\/p>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li>Open the dump file in a text editor<\/li>\n\n\n\n<li>Search for the text shown in the error message<\/li>\n\n\n\n<li>Fix the statement and retry the import<\/li>\n<\/ol>\n\n\n\n<p>For dumps from older MySQL versions, search for \u201c<code>TYPE=<\/code>\u201d and replace with \u201c<code>ENGINE=<\/code>\u201c.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Stored Procedures and Functions<\/h3>\n\n\n\n<p>Stored procedure definitions contain multiple statements, which requires changing the delimiter temporarily:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>DELIMITER \/\/\nCREATE PROCEDURE GetUserCount()\nBEGIN\n    SELECT COUNT(*) FROM users;\nEND \/\/\nDELIMITER ;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">DELIMITER <\/span><span style=\"color: #F97583\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">CREATE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">PROCEDURE<\/span><span style=\"color: #E1E4E8\"> GetUserCount()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">BEGIN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">SELECT<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">COUNT<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">FROM<\/span><span style=\"color: #E1E4E8\"> users;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">END<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">DELIMITER ;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Without the <code>DELIMITER<\/code> change, MySQL interprets the first semicolon as the end of the <code>CREATE PROCEDURE<\/code> statement, producing a syntax error.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Running SQL from Programming Languages<\/h3>\n\n\n\n<p>When you see Error 1064 from application code, log the complete SQL string immediately before execution. Driver libraries sometimes modify queries, and seeing the exact text MySQL receives reveals problems hidden in your source code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Error 1064 Summary<\/h2>\n\n\n\n<p><strong>MySQL Error 1064 indicates a syntax problem at a specific location in your query<\/strong>. The error message identifies where parsing failed, and the cause is almost always one of these issues:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Misspelled commands<\/li>\n\n\n\n<li>Reserved words used without backticks<\/li>\n\n\n\n<li>Missing commas, quotes, or parentheses<\/li>\n\n\n\n<li>Empty variables in dynamically built queries<\/li>\n\n\n\n<li>Obsolete commands from older MySQL versions<\/li>\n<\/ul>\n\n\n\n<p>Methodical checking, starting from the position MySQL identifies and working backward, resolves most cases within minutes. For persistent problems, syntax validators and simplified test queries isolate the issue faster than reviewing the full statement repeatedly.<\/p>\n\n\n\n<p>If you manage WordPress or other database-driven applications on your own server, having reliable hosting with 24\/7 human support helps when database issues arise unexpectedly. Our <a href=\"https:\/\/www.inmotionhosting.com\/vps-hosting\">VPS Hosting<\/a> includes managed MySQL with expert assistance available around the clock.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL Error 1064 appears when the database engine cannot parse your SQL statement. The error message typically reads: &#8220;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 &#8216;\u2026&#8217; at line X.&#8221; The good news: this error always points to<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\"> Read More ><\/a><\/p>\n","protected":false},"author":56983,"featured_media":129242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4335,4305],"tags":[],"class_list":["post-2600","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-error-numbers","category-databases"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Error 1064: Causes, Fixes, and Prevention Tips<\/title>\n<meta name=\"description\" content=\"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Error 1064: Causes, Fixes, and Prevention Tips\" \/>\n<meta property=\"og:description\" content=\"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-10T16:40:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-31T20:05:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Carrie Smaha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@carriesmaha\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carrie Smaha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\"},\"author\":{\"name\":\"Carrie Smaha\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\"},\"headline\":\"MySQL Error 1064: You Have an Error in Your SQL Syntax\",\"datePublished\":\"2013-04-10T16:40:22+00:00\",\"dateModified\":\"2025-12-31T20:05:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\"},\"wordCount\":1414,\"commentCount\":231,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png\",\"articleSection\":[\"Website Error Numbers\",\"Working with Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\",\"name\":\"MySQL Error 1064: Causes, Fixes, and Prevention Tips\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png\",\"datePublished\":\"2013-04-10T16:40:22+00:00\",\"dateModified\":\"2025-12-31T20:05:12+00:00\",\"description\":\"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png\",\"width\":1200,\"height\":630,\"caption\":\"featured image with text MySQL 1064 error troubleshoot and fix SQL syntax error\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Error 1064: You Have an Error in Your SQL Syntax\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\",\"name\":\"Carrie Smaha\",\"description\":\"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/carriesmaha\/\",\"https:\/\/x.com\/carriesmaha\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Error 1064: Causes, Fixes, and Prevention Tips","description":"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Error 1064: Causes, Fixes, and Prevention Tips","og_description":"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2013-04-10T16:40:22+00:00","article_modified_time":"2025-12-31T20:05:12+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","type":"image\/png"}],"author":"Carrie Smaha","twitter_card":"summary_large_image","twitter_creator":"@carriesmaha","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Carrie Smaha","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/"},"author":{"name":"Carrie Smaha","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8"},"headline":"MySQL Error 1064: You Have an Error in Your SQL Syntax","datePublished":"2013-04-10T16:40:22+00:00","dateModified":"2025-12-31T20:05:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/"},"wordCount":1414,"commentCount":231,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","articleSection":["Website Error Numbers","Working with Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/","name":"MySQL Error 1064: Causes, Fixes, and Prevention Tips","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","datePublished":"2013-04-10T16:40:22+00:00","dateModified":"2025-12-31T20:05:12+00:00","description":"Fix MySQL Error 1064 syntax errors quickly. Learn the common causes including typos, reserved words, and obsolete commands, plus step-by-step solutions.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","width":1200,"height":630,"caption":"featured image with text MySQL 1064 error troubleshoot and fix SQL syntax error"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/error-1064\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"MySQL Error 1064: You Have an Error in Your SQL Syntax"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8","name":"Carrie Smaha","description":"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.","sameAs":["https:\/\/www.linkedin.com\/in\/carriesmaha\/","https:\/\/x.com\/carriesmaha"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/"}]}},"jetpack_featured_media_url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2013\/04\/mysql-1064-error-featured.png","jetpack_sharing_enabled":true,"primary_category":{"id":4305,"name":"Working with Databases","slug":"databases","link":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/56983"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=2600"}],"version-history":[{"count":19,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2600\/revisions"}],"predecessor-version":[{"id":131416,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2600\/revisions\/131416"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media\/129242"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=2600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=2600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=2600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}