Elias
ourservices
ourmodules
ourwork
ourteam
ourblog
« Go Back

Dec 1

Tuesday

Magento Database Import Error: USING BTREE, KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`), KEY `FK_CATALO’ at line 9

10
Comment(s)


Tonight I was setting up a staging environment for a client of ours so they would have the ability to “visually” interact with the recent data migration our team has performed (OSCommerce to Magento, in case anyone was wondering).

Here’s the error I was receiving:

ERROR 1064 (42000) at line 382: 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,
KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`),
KEY `FK_CATALO’ at line 9

The reason behind this is that there is an inconsistency in the way the export syntax was being handled as I imported into the staging environment (which evidently has a different MySQL version running). Thus, the staging site was expecting different syntax for the following:

–
– Table structure for table `catalog_category_entity_varchar`
–
DROP TABLE IF EXISTS `catalog_category_entity_varchar`;
CREATE TABLE `catalog_category_entity_varchar` (
`value_id` int(11) NOT NULL AUTO_INCREMENT,
`entity_type_id` smallint(5) unsigned NOT NULL DEFAULT ‘0′,
`attribute_id` smallint(5) unsigned NOT NULL DEFAULT ‘0′,
`store_id` smallint(5) unsigned NOT NULL DEFAULT ‘0′,
`entity_id` int(10) unsigned NOT NULL DEFAULT ‘0′,
`value` varchar(255) NOT NULL DEFAULT ”,
PRIMARY KEY (`value_id`),
UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`) USING BTREE,
KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`),
KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE` (`attribute_id`),
KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE` (`store_id`)
) ENGINE=InnoDB AUTO_INCREMENT=697 DEFAULT CHARSET=utf8;

As a rule of thumb, one can either

  • (1) head over to the MySQL Developer Documentation for syntax reference
  • (2) or simply check out a recent Magento export from the server they are trying to import into and determine how the “USING BTREE” statement was handled. Likewise, I simply removed the following:

UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`) USING BTREE,

and replaced it with this:

UNIQUE KEY `IDX_BASE` USING BTREE (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),

Hope this helps someone who is experiencing the same error and spending way too much time trying to understand the incompatible syntax.

  • Twitter
  • Facebook
  • Delicious
  • LinkedIn
  • Digg
  • StumbleUpon
  • Technorati Favorites
  • Google Reader
  • Gmail
  • Tumblr
  • Blogger Post
  • Share/Save

Tags: ERROR 1064 (42000) at line 382: 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, KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`), KEY `FK_CATALO' at line 9, Magento Database Import Error, Magento database migration 

10 Comments



ceddddd says:

December 4th, 2009 at 8:50 am


Very good information thank you its work

sorry for my english :)


Michi says:

December 16th, 2009 at 10:24 am


Thank you very much. I thought i’m going crazy on this problem. You saved me a lot of time.


Moe says:

December 24th, 2009 at 5:29 pm


THANKS!! You’re a life saver =)


ahmed says:

February 2nd, 2010 at 11:59 pm


I can’t tell you how much time this saved me! Thanks for the post.


magento verplaatsen van lokaal naar live server says:

February 9th, 2010 at 4:54 am


[...] niet om deze database te uploaden. Na wat googlen op de foutmelding kwam ik op de volgende site Elias Interactive , hier werd uitgelegd wat ik fout deed en vervolgens heb ik dit aangepast en voila de database [...]


nico says:

February 9th, 2010 at 11:37 am


you’re my savior dude..


Rob says:

February 23rd, 2010 at 5:37 am


Wow, this really saved me some time! I ran into the exact same thing with my Magento store. Thanks a lot for writing this, I would have spent a load of time trying to figure this out…


Lee Taylor says:

February 23rd, 2010 at 2:47 pm


Great to hear @Rob! Very glad it helped. Feel free to share any findings with us that you deem to be useful for others as well.

Cheers!


Stéphane says:

March 1st, 2010 at 12:22 pm


Just in case you would like more information about this issue, here is the MySQL bug report: http://bugs.mysql.com/bug.php?id=25162. If you have MySQL 5.0.60 and greater (or 5.1.24 and greater), everything should be fine.


Lee Taylor says:

March 1st, 2010 at 4:05 pm


Right on @Stéphane! Thanks for sharing.

Leave a comment




RSSNew Here?

You should grab our RSS Feed to get updates.


RSSSearch Our Blog



TagsTag Cloud

    business tools coda-slider consulting copy create unique prefix for order numbers custom customize magento custom magento delete test orders Design design content Development dropbox ecommerce stores email marketing fancybox featured products featured products on home page install magento integration Magento Magento advice Magento Commerce magento customization Magento Custom Module magento custom theme magento developer magento development magento ecommerce Magento help magento installation magento modification magento online store magento open source Magento Payment Method magento service provider magento services magento template magento theme magneto ecommerce marketing magento modify magento open source ecommerce scene 7 startup




aboutus

It's simple. Elias Interactive exists to help you get the most out of your software - be it a company website or ecommerce store. Our team is a leader in the popular Magento ecommerce community, works with a variety of CMS solutions, and builds elegant UI designs. We are a small, talented group of tech fanatics. We have an uncompromising commitment to do the right thing. And we are passionate about what we do - changing the world one line of code at a time.


clienttestimonials

videoWhy Elias?
videoWould You Recommend Elias?



Let's Talk


recentposts

Rework Book Critique

Rework is exactly what you would expect from 37signals - simple, easy to read, and "at home good". About 80% of the book's ideas are already accessible in keynotes and interviews. But a succinct,...
Continue Reading »

sep
Pandora persevered: NY Times quote

From March 7, 2010 New York Times article about Pandora radio: It is all a long way from January 2000, when Mr. Westergren founded . Trained as a jazz pianist, he spent a decade playing in rock...
Continue Reading »

sep

» Read More

needsupport?

ContactSubmit a Request
CampfireLive Support is Unavailable at this time



twitterupdates

Does your startup pass The Sleep Test? http://bit.ly/d8QYBS
1 day ago

Thanks @jamespaden for the RT
1 week ago

New Elias #magento module store live with 1st module for sale: configurable bundle products. http://bit.ly/9F1T69
1 week ago

Posting tweet...


» Follow us to stay in the loop





Home | Our Services | Our Modules | Our Work | Our Team | Our Blog

Copyright © 2008-2009 Elias Interactive. All rights reserved.