Tags I am associated with:

Tags I am associated with: Microsoft SQL Server, IBM Cognos BI and Planning, Deltek Costpoint, Deltek Time & Expense, Magento, Intuit QuickBooks, Visual Basic 6, SSIS, Oracle, SQL development, data warehouse, reporting, eCommerce, accounting, finance, ETL

Monday, September 5, 2011

Magento Error: Base table or view already exists: 1050 Table ’sales_order_status’ already exists

Scenario: After changing permissions on folders/files in var/cache/, the Magento site was crashing with this error:

Base table or view already exists: 1050 Table ’sales_order_status’ already exists

________
It looks as if the software is trying to upgrade from 1.4 to 1.5, but the new tables are already there.

Workaround: Log into database with the MySQL account and run these SQL statements (in the following order to avoid foreign key constraints) to drop the new tables:

drop table sales_order_status_label;
drop table sales_order_status_state;
drop table sales_order_status;
drop table paypal_cert;

After executing these statements, hit the site again via web browser, and the software should recreate the 4 tables along with finishing the upgrade.

Note: I've locked down the permissions on folders and files, but looks like Magento upgrade creates new folder/files with 777 permission owned by apache user. You may have to change the permissions on these new folder/files to your liking...

2 comments:

  1. I tried to fix this problem i had on a development site. Thank god i found this site because this was exactly the same problem i had.

    But remove the tables didn't help. They kept coming back and i got stuck. After several days of reinstalling and reinstalling i found a better solutions.

    Adding some extra lines to the php file in my case (mysql4-upgrade-1.4.0.22-1.4.0.23.php) did fix the error and completed the upgrade.

    For every table that fails add the following line:
    DROP TABLE IF EXISTS {$this->getTable('name_of_the_table')};

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete