0

I am getting error when importing database to server.

#1005 - Can't create table 'smartools.sales_flat_quote_item' (errno: -1)

CREATE TABLE sales_flat_quote_item ( item_id int( 10 ) UNSIGNED NOT NULL COMMENT 'Item Id', quote_id int( 10 ) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Quote Id', created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Created At', updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Updated At', product_id int( 10 ) UNSIGNED DEFAULT NULL COMMENT 'Product Id', store_id smallint( 5 ) UNSIGNED DEFAULT NULL COMMENT 'Store Id', parent_item_id int( 10 ) UNSIGNED DEFAULT NULL COMMENT 'Parent Item Id', is_virtual smallint( 5 ) UNSIGNED DEFAULT NULL COMMENT 'Is Virtual', sku varchar( 255 ) DEFAULT NULL COMMENT 'Sku', name varchar( 255 ) DEFAULT NULL COMMENT 'Name', description text COMMENT 'Description', applied_rule_ids text COMMENT 'Applied Rule Ids', additional_data text COMMENT 'Additional Data', free_shipping smallint( 5 ) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Free Shipping', is_qty_decimal smallint( 5 ) UNSIGNED DEFAULT NULL COMMENT 'Is Qty Decimal', no_discount smallint( 5 ) UNSIGNED DEFAULT '0' COMMENT 'No Discount', weight decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Weight', qty decimal( 12, 4 ) NOT NULL DEFAULT '0.0000' COMMENT 'Qty', price decimal( 12, 4 ) NOT NULL DEFAULT '0.0000' COMMENT 'Price', base_price decimal( 12, 4 ) NOT NULL DEFAULT '0.0000' COMMENT 'Base Price', custom_price decimal( 12, 4 ) DEFAULT NULL COMMENT 'Custom Price', discount_percent decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Discount Percent', discount_amount decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Discount Amount', base_discount_amount decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Base Discount Amount', tax_percent decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Tax Percent', tax_amount decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Tax Amount', base_tax_amount decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Base Tax Amount', row_total decimal( 12, 4 ) NOT NULL DEFAULT '0.0000' COMMENT 'Row Total', base_row_total decimal( 12, 4 ) NOT NULL DEFAULT '0.0000' COMMENT 'Base Row Total', row_total_with_discount decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Row Total With Discount', row_weight decimal( 12, 4 ) DEFAULT '0.0000' COMMENT 'Row Weight', product_type varchar( 255 ) DEFAULT NULL COMMENT 'Product Type', base_tax_before_discount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Tax Before Discount', tax_before_discount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Tax Before Discount', original_custom_price decimal( 12, 4 ) DEFAULT NULL COMMENT 'Original Custom Price', redirect_url varchar( 255 ) DEFAULT NULL COMMENT 'Redirect Url', base_cost decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Cost', price_incl_tax decimal( 12, 4 ) DEFAULT NULL COMMENT 'Price Incl Tax', base_price_incl_tax decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Price Incl Tax', row_total_incl_tax decimal( 12, 4 ) DEFAULT NULL COMMENT 'Row Total Incl Tax', base_row_total_incl_tax decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Row Total Incl Tax', hidden_tax_amount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Hidden Tax Amount', base_hidden_tax_amount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Hidden Tax Amount', gift_message_id int( 11 ) DEFAULT NULL COMMENT 'Gift Message Id', weee_tax_disposition decimal( 12, 4 ) DEFAULT NULL COMMENT 'Weee Tax Disposition', weee_tax_row_disposition decimal( 12, 4 ) DEFAULT NULL COMMENT 'Weee Tax Row Disposition', base_weee_tax_disposition decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Weee Tax Disposition', base_weee_tax_row_disposition decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Weee Tax Row Disposition', weee_tax_applied text COMMENT 'Weee Tax Applied', weee_tax_applied_amount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Weee Tax Applied Amount', weee_tax_applied_row_amount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Weee Tax Applied Row Amount', base_weee_tax_applied_amount decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Weee Tax Applied Amount', base_weee_tax_applied_row_amnt decimal( 12, 4 ) DEFAULT NULL COMMENT 'Base Weee Tax Applied Row Amnt' ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'Sales Flat Quote Item';

Can anyone help?

0

Error code #1005 can be caused by:

  • An existing table with same name
  • A problem with your foreign keys

Option 1 (An existing table with same name):

You have to drop that table or modify your import key with a CREATE TABLE IF NOT EXISTS syntax.

Option 2 (A problem with your foreign keys):

Add the following line on the very top of your SQL script:

SET FOREIGN_KEY_CHECKS=0;

And the following at the very end:

SET FOREIGN_KEY_CHECKS=1;
  • I already did that.. When i export database that time I disabled foreign key check also i added drop table command.. But the strange thing is if i made a table with sales_flat_quote_item name this is showing that table can not be created error code -1 – Asish Hira May 23 '16 at 5:49
  • Something in the MySQL log? Did you check if such table already exists? – Phoenix128_RiccardoT May 23 '16 at 7:34
  • Yes i checked that table not exits – Asish Hira May 23 '16 at 7:50
  • The same query works if i change the table name only – Asish Hira May 23 '16 at 7:50
  • Check in your MySQL directory if you see a file named "sales_flat_quote_item.frm". If yes you may have a DB inconistency. If yes drop the whole DB, recreate and reimport. Ps.: Make sure you have enough space. – Phoenix128_RiccardoT May 23 '16 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.