Answers.Body: <p>Here's the key part from the logs:</p>
  
  <blockquote>
    <p>2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsettings'</p>
  </blockquote>
  
  <p>The <code>elementindexsettings</code> table was introduced in Craft 2.5.  The fact that is already exists during this update indicates that you've already got some 2.5 database schema changes already in place.</p>
  
  <p>Most likely this occurred from a previous 2.5 update attempt that failed (for whatever reason) and the database wasn't restored from a pre-2.5 update attempt backup before another update was applied.</p>
  
  <p>Restore the database from a pre-update attempt database backup and try the update again.  If it fails that time, you can look in the log files to get the initial error that occurred.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-21T19:00:58.320Z
Answers.LastActivityDate: 2016-12-21T19:00:58.320Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>FWIW, I had this same error when updating to 2.6.2956 today. I deleted my old app folder, replaced it with a fresh one, and still got the same error message.</p>
  
  <p>Found the same error in my logfiles, so I looked at the tables and saw that my <code>craft_elementindexsettings</code> was empty, so I dropped it and tried the manual migration again, and it went through with no problem.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-30T18:31:06.720Z
Answers.LastActivityDate: 2016-12-30T18:31:06.720Z
Answers.UserDisplayName: Vincent
Body: <p>I've got an issue that following a server rebuild, I was prompted to update Craft, which I did by moving a brand new craft/app folder into place - then setting relevant permissions. I then tried to browse to the management once again, to be greeted by the 'finish up' button and the fact that Craft had to make a couple of changes to the database to finish the update. This is where I am encountering an error message of:</p>
  
  <p><em>Craft was unable to install this update :(
  The site has been restored to the state it was in before the attempted update.
  There was a problem updating your database.</em></p>
  
  <p>My database credentials are correct, and I have had this issue on 2 servers now with different builds (different ubuntu version, php, apache &amp; sql). Could anybody tell me if they have seen this before and how to diagnose this issue?</p>
  
  <p>Ubuntu 16.04.1
  PHP7.0
  Mysql 5.7
  Apache 2.4.18</p>
  
  <p>Craft log of the incident:</p>
  
  <pre><code>2016/12/21 10:35:49 [info] [application] [Forced] Preparing to update craft.
  2016/12/21 10:35:49 [info] [application] [Forced] Finished preparing to update craft.
  
  ******************************************************************************************************
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
  2016/12/21 10:35:49 [info] [application] [Forced] Finished backing up database.
  
  ******************************************************************************************************
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to update the database.
  2016/12/21 10:35:49 [info] [application] [Forced] Craft wants to update the database.
  2016/12/21 10:35:49 [info] [application] [Forced] Running migrations...
  2016/12/21 10:35:49 [info] [application] [Forced] Total 23 new migrations to be applied for Craft:
  2016/12/21 10:35:49 [info] [application] [Forced] m141030_000000_plugin_schema_versions
  2016/12/21 10:35:49 [info] [application] [Forced] m150724_000001_adjust_quality_settings
  2016/12/21 10:35:49 [info] [application] [Forced] m150827_000000_element_index_settings
  2016/12/21 10:35:49 [info] [application] [Forced] m150918_000001_add_colspan_to_widgets
  2016/12/21 10:35:49 [info] [application] [Forced] m151007_000000_clear_asset_caches
  2016/12/21 10:35:49 [info] [application] [Forced] m151109_000000_text_url_formats
  2016/12/21 10:35:49 [info] [application] [Forced] m151110_000000_move_logo
  2016/12/21 10:35:49 [info] [application] [Forced] m151117_000000_adjust_image_widthheight
  2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_clear_license_key_status
  2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_plugin_license_keys
  2016/12/21 10:35:49 [info] [application] [Forced] m151130_000000_update_pt_widget_feeds
  2016/12/21 10:35:49 [info] [application] [Forced] m160114_000000_asset_sources_public_url_default_true
  2016/12/21 10:35:49 [info] [application] [Forced] m160223_000000_sortorder_to_smallint
  2016/12/21 10:35:49 [info] [application] [Forced] m160229_000000_set_default_entry_statuses
  2016/12/21 10:35:49 [info] [application] [Forced] m160304_000000_client_permissions
  2016/12/21 10:35:49 [info] [application] [Forced] m160322_000000_asset_filesize
  2016/12/21 10:35:49 [info] [application] [Forced] m160503_000000_orphaned_fieldlayouts
  2016/12/21 10:35:49 [info] [application] [Forced] m160510_000000_tasksettings
  2016/12/21 10:35:49 [info] [application] [Forced] m160829_000000_pending_user_content_cleanup
  2016/12/21 10:35:49 [info] [application] [Forced] m160830_000000_asset_index_uri_increase
  2016/12/21 10:35:49 [info] [application] [Forced] m160919_000000_usergroup_handle_title_unique
  2016/12/21 10:35:49 [info] [application] [Forced] m161108_000000_new_version_format
  2016/12/21 10:35:49 [info] [application] [Forced] m161109_000000_index_shuffle
  2016/12/21 10:35:49 [info] [application] [Forced] Applying migration: m141030_000000_plugin_schema_versions
  2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m141030_000000_plugin_schema_versions (time: 0.121s)
  2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150724_000001_adjust_quality_settings
  2016/12/21 10:35:50 [info] [application] [Forced] Adjusting Asset transform quality settings
  2016/12/21 10:35:50 [info] [application] [Forced] Done adjusting Asset transform quality settings
  2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m150724_000001_adjust_quality_settings (time: 0.005s)
  2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150827_000000_element_index_settings
  2016/12/21 10:35:50 [info] [application] [Forced] Creating the elementindexsettings table
  2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsett$
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `type` VARCHAR(150) NOT NULL,
          `settings` text NULL,
          `dateCreated` datetime NOT NULL,
          `dateUpdated` datetime NOT NULL,
          `uid` CHAR(36) NOT NULL DEFAULT 0,
          PRIMARY KEY (id)
  ) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.
  2016/12/21 10:35:50 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_element$
  2016/12/21 10:35:50 [error] [application] #0 /var/www/craft/app/framework/db/CDbCommand.php(1352): CDbCommand-&gt;execute()
  #1 /var/www/craft/app/etc/db/DbCommand.php(507): CDbCommand-&gt;createTable('Ui28t_elementin...', Array, NULL)
  #2 /var/www/craft/app/migrations/m150827_000000_element_index_settings.php(21): Craft\DbCommand-&gt;createTable('Ui28t_elementin...', Array, NULL, true)
  #3 /var/www/craft/app/etc/db/BaseMigration.php(33): Craft\m150827_000000_element_index_settings-&gt;safeUp()
  #4 /var/www/craft/app/services/MigrationsService.php(149): Craft\BaseMigration-&gt;up()
  #5 /var/www/craft/app/services/MigrationsService.php(91): Craft\MigrationsService-&gt;migrateUp('m150827_000000_...', NULL)
  #6 /var/www/craft/app/etc/updates/Updater.php(180): Craft\MigrationsService-&gt;runToTop(NULL)
  #7 /var/www/craft/app/services/UpdatesService.php(724): Craft\Updater-&gt;updateDatabase()
  #8 /var/www/craft/app/controllers/UpdateController.php(405): Craft\UpdatesService-&gt;updateDatabase('craft')
  #9 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController-&gt;actionUpdateDatabase()
  #10 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #11 /var/www/craft/app/framework/web/CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #12 /var/www/craft/app/framework/web/CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #13 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&gt;run('updateDatabase')
  #14 /var/www/craft/app/etc/web/WebApp.php(931): CWebApplication-&gt;runController('update/updateDa...')
  #15 /var/www/craft/app/etc/web/WebApp.php(241): Craft\WebApp-&gt;_processUpdateLogic()
  #16 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
  #17 /var/www/craft/app/index.php(62): CApplication-&gt;run()
  #18 /var/www/public_html/index.php(19): require_once('/var/www/craft/...')
  #19 {main}
  2016/12/21 10:35:50 [error] [application] Failed to apply migration: m150827_000000_element_index_settings (time: 0.001s)
  2016/12/21 10:35:50 [error] [application] Migration failed for Craft. All later Craft migrations are canceled.
  
  ******************************************************************************************************
  2016/12/21 10:35:50 [info] [application] [Forced] Rolling back any database changes.
  </code></pre>
  
  <p>Many thanks in advance guys! Let me know if you need any more info.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T12:13:08.217Z
Comments.Text: Not sure exactly, but there's an issue with Craft 2.x and MySQL 5.7 that _might_ be the reason you're seeing these errors. See [Brad's answer here](http://craftcms.stackexchange.com/a/12106/1098) for a fix.
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T13:07:54.023Z
Comments.Text: Cheers for the comment Mikkel, I've hit a couple of issues with 5.7 but these were resolved. Initially I looked at an older server build using MySQL 5.5 and hit the exact same issue, which makes me think its something within the configuration of craft.
Comments.UserDisplayName: user5989
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T14:15:56.823Z
Comments.Text: Allrite, it was worth a shot. You might want to hit up support@craftcms.com for this one, or ask for help on the official Craft Slack :)
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Tags: <database><auto-updates><updates><manual-updates>
Title: Craft cannot finalise update - There was a problem updating your database
ThreadText: # Craft cannot finalise update - There was a problem updating your database
  
  (Asked by: username_0 on 2016-12-21)
  
  I've got an issue that following a server rebuild, I was prompted to update Craft, which I did by moving a brand new craft/app folder into place - then setting relevant permissions. I then tried to browse to the management once again, to be greeted by the 'finish up' button and the fact that Craft had to make a couple of changes to the database to finish the update. This is where I am encountering an error message of:
  
  *Craft was unable to install this update :(
  The site has been restored to the state it was in before the attempted update.
  There was a problem updating your database.*
  
  My database credentials are correct, and I have had this issue on 2 servers now with different builds (different ubuntu version, php, apache & sql). Could anybody tell me if they have seen this before and how to diagnose this issue?
  
  Ubuntu 16.04.1
  PHP7.0
  Mysql 5.7
  Apache 2.4.18
  
  Craft log of the incident:
  
  ```
  2016/12/21 10:35:49 [info] [application] [Forced] Preparing to update craft.
  2016/12/21 10:35:49 [info] [application] [Forced] Finished preparing to update craft.
  
  ******************************************************************************************************
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
  2016/12/21 10:35:49 [info] [application] [Forced] Finished backing up database.
  
  ******************************************************************************************************
  2016/12/21 10:35:49 [info] [application] [Forced] Starting to update the database.
  2016/12/21 10:35:49 [info] [application] [Forced] Craft wants to update the database.
  2016/12/21 10:35:49 [info] [application] [Forced] Running migrations...
  2016/12/21 10:35:49 [info] [application] [Forced] Total 23 new migrations to be applied for Craft:
  2016/12/21 10:35:49 [info] [application] [Forced] m141030_000000_plugin_schema_versions
  2016/12/21 10:35:49 [info] [application] [Forced] m150724_000001_adjust_quality_settings
  2016/12/21 10:35:49 [info] [application] [Forced] m150827_000000_element_index_settings
  2016/12/21 10:35:49 [info] [application] [Forced] m150918_000001_add_colspan_to_widgets
  2016/12/21 10:35:49 [info] [application] [Forced] m151007_000000_clear_asset_caches
  2016/12/21 10:35:49 [info] [application] [Forced] m151109_000000_text_url_formats
  2016/12/21 10:35:49 [info] [application] [Forced] m151110_000000_move_logo
  2016/12/21 10:35:49 [info] [application] [Forced] m151117_000000_adjust_image_widthheight
  2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_clear_license_key_status
  2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_plugin_license_keys
  2016/12/21 10:35:49 [info] [application] [Forced] m151130_000000_update_pt_widget_feeds
  2016/12/21 10:35:49 [info] [application] [Forced] m160114_000000_asset_sources_public_url_default_true
  2016/12/21 10:35:49 [info] [application] [Forced] m160223_000000_sortorder_to_smallint
  2016/12/21 10:35:49 [info] [application] [Forced] m160229_000000_set_default_entry_statuses
  2016/12/21 10:35:49 [info] [application] [Forced] m160304_000000_client_permissions
  2016/12/21 10:35:49 [info] [application] [Forced] m160322_000000_asset_filesize
  2016/12/21 10:35:49 [info] [application] [Forced] m160503_000000_orphaned_fieldlayouts
  2016/12/21 10:35:49 [info] [application] [Forced] m160510_000000_tasksettings
  2016/12/21 10:35:49 [info] [application] [Forced] m160829_000000_pending_user_content_cleanup
  2016/12/21 10:35:49 [info] [application] [Forced] m160830_000000_asset_index_uri_increase
  2016/12/21 10:35:49 [info] [application] [Forced] m160919_000000_usergroup_handle_title_unique
  2016/12/21 10:35:49 [info] [application] [Forced] m161108_000000_new_version_format
  2016/12/21 10:35:49 [info] [application] [Forced] m161109_000000_index_shuffle
  2016/12/21 10:35:49 [info] [application] [Forced] Applying migration: m141030_000000_plugin_schema_versions
  2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m141030_000000_plugin_schema_versions (time: 0.121s)
  2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150724_000001_adjust_quality_settings
  2016/12/21 10:35:50 [info] [application] [Forced] Adjusting Asset transform quality settings
  2016/12/21 10:35:50 [info] [application] [Forced] Done adjusting Asset transform quality settings
  2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m150724_000001_adjust_quality_settings (time: 0.005s)
  2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150827_000000_element_index_settings
  2016/12/21 10:35:50 [info] [application] [Forced] Creating the elementindexsettings table
  2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsett$
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `type` VARCHAR(150) NOT NULL,
          `settings` text NULL,
          `dateCreated` datetime NOT NULL,
          `dateUpdated` datetime NOT NULL,
          `uid` CHAR(36) NOT NULL DEFAULT 0,
          PRIMARY KEY (id)
  ) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.
  2016/12/21 10:35:50 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_element$
  2016/12/21 10:35:50 [error] [application] #0 /var/www/craft/app/framework/db/CDbCommand.php(1352): CDbCommand->execute()
  #1 /var/www/craft/app/etc/db/DbCommand.php(507): CDbCommand->createTable('Ui28t_elementin...', Array, NULL)
  #2 /var/www/craft/app/migrations/m150827_000000_element_index_settings.php(21): Craft\DbCommand->createTable('Ui28t_elementin...', Array, NULL, true)
  #3 /var/www/craft/app/etc/db/BaseMigration.php(33): Craft\m150827_000000_element_index_settings->safeUp()
  #4 /var/www/craft/app/services/MigrationsService.php(149): Craft\BaseMigration->up()
  #5 /var/www/craft/app/services/MigrationsService.php(91): Craft\MigrationsService->migrateUp('m150827_000000_...', NULL)
  #6 /var/www/craft/app/etc/updates/Updater.php(180): Craft\MigrationsService->runToTop(NULL)
  #7 /var/www/craft/app/services/UpdatesService.php(724): Craft\Updater->updateDatabase()
  #8 /var/www/craft/app/controllers/UpdateController.php(405): Craft\UpdatesService->updateDatabase('craft')
  #9 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController->actionUpdateDatabase()
  #10 /var/www/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
  #11 /var/www/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
  #12 /var/www/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
  #13 /var/www/craft/app/framework/web/CWebApplication.php(282): CController->run('updateDatabase')
  #14 /var/www/craft/app/etc/web/WebApp.php(931): CWebApplication->runController('update/updateDa...')
  #15 /var/www/craft/app/etc/web/WebApp.php(241): Craft\WebApp->_processUpdateLogic()
  #16 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
  #17 /var/www/craft/app/index.php(62): CApplication->run()
  #18 /var/www/public_html/index.php(19): require_once('/var/www/craft/...')
  #19 {main}
  2016/12/21 10:35:50 [error] [application] Failed to apply migration: m150827_000000_element_index_settings (time: 0.001s)
  2016/12/21 10:35:50 [error] [application] Migration failed for Craft. All later Craft migrations are canceled.
  
  ******************************************************************************************************
  2016/12/21 10:35:50 [info] [application] [Forced] Rolling back any database changes.
  
  ```
  
  Many thanks in advance guys! Let me know if you need any more info.
  
  **Tags:** database, auto-updates, updates, manual-updates
  
  > **Comments:**
  > **username_1**: Not sure exactly, but there's an issue with Craft 2.x and MySQL 5.7 that _might_ be the reason you're seeing these errors. See [username_2's answer here](http://craftcms.stackexchange.com/a/12106/1098) for a fix.  
  > **username_0**: Cheers for the comment Mikkel, I've hit a couple of issues with 5.7 but these were resolved. Initially I looked at an older server build using MySQL 5.5 and hit the exact same issue, which makes me think its something within the configuration of craft.  
  > **username_1**: Allrite, it was worth a shot. You might want to hit up support@craftcms.com for this one, or ask for help on the official Craft Slack :)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-12-21. Score: 1 | Accepted answer
  
  Here's the key part from the logs:
  
  > 2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t\_elementindexsettings'
  
  The `elementindexsettings` table was introduced in Craft 2.5. The fact that is already exists during this update indicates that you've already got some 2.5 database schema changes already in place.
  
  Most likely this occurred from a previous 2.5 update attempt that failed (for whatever reason) and the database wasn't restored from a pre-2.5 update attempt backup before another update was applied.
  
  Restore the database from a pre-update attempt database backup and try the update again. If it fails that time, you can look in the log files to get the initial error that occurred.
  
  
  ---
  
  ### Answer by username_3 on 2016-12-30. Score: 1
  
  FWIW, I had this same error when updating to 2.6.2956 today. I deleted my old app folder, replaced it with a fresh one, and still got the same error message.
  
  Found the same error in my logfiles, so I looked at the tables and saw that my `craft_elementindexsettings` was empty, so I dropped it and tried the manual migration again, and it went through with no problem.
  
  
  ---
  
  