I am trying to upgrade to from through Magento Downloader. On the screen at the bottom, I am getting the error message below:

Exception during cache and session cleaning: Error in file: "app/code/core/Mage/Admin/sql/admin_setup/upgrade-" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'mage_permission_variable' already exists, query was: CREATE TABLE `mage_permission_variable` ( `variable_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Variable ID' , `variable_name` varchar(255) NOT NULL default '' COMMENT 'Config Path' , `is_allowed` bool NOT NULL default '0' COMMENT 'Mark that config can be processed by filters' , PRIMARY KEY (`variable_id`, `variable_name`), UNIQUE `UNQ_MAGE_PERMISSION_VARIABLE_VARIABLE_NAME` (`variable_name`) ) COMMENT='System variables that can be processed via content filter' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci.........................

It repeats this quite a few times and then just stays there and the website is broken.

I'm not at all technical with Magento - could someone help me diagnose what's wrong and how I fix it (in as simple steps as possible!)?

  • 1
    I saw another post and if I delete 'upgrade-' then everything appears to work. Is it OK to just delete this file or will it cause me problems in the future?
    – user32880
    Nov 6, 2015 at 19:57
  • i think you already had applied patch-6788 that creates variable and permissions block. So do not delete the file just comment out that sql code and run setup. After successful run uncomment code. Sep 9, 2016 at 5:37

2 Answers 2


That means you already have the mage_permission_variable table in your database.
Don't delete the file instead of you can drop mage_permission_variable and mage_permission_block table then continue you upgrading process

it will do the trick....

Don't forget to backup the database before dropping those tables

Hope it helps

  • 2
    These tables are from a previous patch the OP has maybe installed. The tables might have some custom values - I mean, at least the mage_permission_block table will have entries. He should not simply drop them, because blocks that are not in the default configuration will miss from the frontend. Apr 13, 2017 at 22:25

Please comment the code which create the db table mage_permission_variable in file upgrade-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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