{"id":1368,"date":"2009-08-04T19:15:19","date_gmt":"2009-08-04T18:15:19","guid":{"rendered":"http:\/\/www.nivas.hr\/blog\/?p=1368"},"modified":"2009-08-07T09:48:20","modified_gmt":"2009-08-07T08:48:20","slug":"you-have-an-error-in-your-sql-syntax-using-btree","status":"publish","type":"post","link":"https:\/\/www.nivas.hr\/blog\/2009\/08\/04\/you-have-an-error-in-your-sql-syntax-using-btree\/","title":{"rendered":"You have an error in your SQL syntax &#8230; USING BTREE"},"content":{"rendered":"<p>If you see error similar to this one on your MySQL 5.0 while trying to import mysql dump exported on MySQL 5.1 (with mysqldump):<br \/>\n<code>ERROR 1064 (42000) at line 417: 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 'USING BTREE<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8' at line 5<\/code><br \/>\n&#8230;you should upgrade to latest mysql. Bummer!<\/p>\n<p>This is old and confirmed <a href=\"http:\/\/bugs.mysql.com\/bug.php?id=25162\">bug #25162<\/a>. The problem was in incompatible syntax for key definition in CREATE TABLE. MySQL 5.0 supports only this syntax:<br \/>\n<code>{INDEX|KEY} [index_name] [index_type] (index_col_name,...)<\/code><br \/>\nwhile MySQL 5.1 preferrs this one :<br \/>\n<code>{INDEX|KEY} [index_name] (index_col_name,...) [index_type]<\/code><br \/>\n..which lead to incompatible dump.<\/p>\n<p>We have this situation &#8211; workstations run MySQL v5.1.33 and our development and production servers are still on 5.0.51a-3ubuntu5.4 (Ubuntu LTS) version. We can&#8217;t upgrade MySQL on servers that easily so I first tried updating my workstation to latest windows version 5.1.37. mysqldump which comes with it is v10.13 Distrib 5.1.37, and it produced exactly the same incompatible output. I even tried x86 and x64 versions &#8211; with same incompatible results. I submited a bug report to MySQL because it seems that this bug was fixed in Windows installer version but not in without-installer version which I used to upgrade my local installation (<a href=\"http:\/\/bugs.mysql.com\/bug.php?id=46598\">bug #46598<\/a>).<\/p>\n<p>This was going nowhere so I downgraded my workstation to <a href=\"http:\/\/dev.mysql.com\/downloads\/mysql\/5.0.html#win32\">MySQL 5.0.84<\/a>. I was then able to do proper export from my workstation and import on our development server. I have no idea why mysqldump in 5.1 version didn&#8217;t get &#8211;compatible=50 switch option. If somebody knows a workaround for this, do share!<\/p>\n<p>If you cant&#8217; upgrade, try exporting from 5.1 with &#8211;compatible=mysql40 switch but doing so will heavily downgrade your dump so beware.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you see error similar to this one on your MySQL 5.0 while trying to import mysql dump exported on MySQL 5.1 (with mysqldump): ERROR 1064 (42000) at line 417: 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&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/1368"}],"collection":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/comments?post=1368"}],"version-history":[{"count":12,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions"}],"predecessor-version":[{"id":1380,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions\/1380"}],"wp:attachment":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/media?parent=1368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/categories?post=1368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/tags?post=1368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}