Answers.Body: <p>The error you posted says, "Hi, I'm trying to create a new table in your database, but that table already exists."</p>
  
  <p>Most commonly, this happens when you do an upgrade, then restore a backup, then attempt the upgrade again.  My guess is that you got a similar-looking (but different!) error previously, restored a backup, then got this on a second upgrade.</p>
  
  <p>The reason this happens is that restoring a backup puts OLD tables back the way they were, but doesn't touch any NEW tables that don't exist in the backup.  So if you upgrade, you can NOT restore your database to the previous version simply by reloading the backup.  You must first <code>DROP &lt;database_name&gt;</code> and <code>CREATE &lt;databasename&gt;</code> so that you're restoring to a clean slate.</p>
  
  <p>Try doing a DROP and CREATE before restoring your database and mark this question solved if that clears this error!  If you have a separate error, please post that as a new question.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-12T20:55:24.257Z
Answers.LastActivityDate: 2016-11-12T20:55:24.257Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>First of all please take a backup of your currect version and then try the below against a test server</p>
  
  <p>Please try to upgrade from 4.0.1 to 4.0.8 first and then try upgrading to 4.1.0
  If you still get some issue then try upgrading to 4.0.1 to 4.0.4 and to 4.0.8 and finally to 4.1.0</p>
  
  <p>I guess this helps !!!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-18T01:11:11.057Z
Answers.Text: Hi Ramesh thank you.  It looks like I had to go 4.01, .02, .03, etc.  but when I got to 4.07, I couldn't run the upgrade script from 4.06.  4.07 upgrade is giving me "HTTP ERROR 500".  Any insight on this?
Answers.UserDisplayName: mmangoba
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-18T08:31:13.923Z
Answers.Text: make sure you have replaced the code base correctly - also please look for any civicrm error log - if nothing helps look for PHP error log - you should have some error - i guess this helps
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-13T08:32:39.757Z
Answers.LastActivityDate: 2016-10-13T08:32:39.757Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>I am having an issue whenever I run the upgrade for 4.0.1 to 4.1.0.  The issue is below:</p>
  
  <pre><code>Cannot execute CREATE TABLE `civicrm_setting` ( 
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 
  `group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'group name for setting element, useful in caching setting elements', 
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique name for setting', 
  `value` text COLLATE utf8_unicode_ci COMMENT 'data associated with this group / name combo', 
  `domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this menu item for', 
  `contact_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Contact ID if the setting is localized to a contact', 
  `is_domain` tinyint(4) DEFAULT NULL COMMENT 'Is this setting a contact specific or site wide setting?', 
  `component_id` int(10) unsigned DEFAULT NULL COMMENT 'Component that this menu item belongs to', 
  `created_date` datetime DEFAULT NULL COMMENT 'When was the setting created', 
  `created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this setting', 
  PRIMARY KEY (`id`), 
  KEY `index_group_name` (`group_name`,`name`), 
  KEY `FK_civicrm_setting_domain_id` (`domain_id`), 
  KEY `FK_civicrm_setting_contact_id` (`contact_id`), 
  KEY `FK_civicrm_setting_component_id` (`component_id`), 
  KEY `FK_civicrm_setting_created_id` (`created_id`), 
  CONSTRAINT `FK_civicrm_setting_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE, 
  CONSTRAINT `FK_civicrm_setting_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE, 
  CONSTRAINT `FK_civicrm_setting_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`), 
  CONSTRAINT `FK_civicrm_setting_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL ) 
  ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1: 
  DB Error: already exists
  </code></pre>
  
Tags: <upgrade>
Title: Upgrading CiviCRM 4.0.1 to 4.1.0
ThreadText: # Upgrading CiviCRM 4.0.1 to 4.1.0
  
  (Asked by: username_0 on 2016-10-12)
  
  I am having an issue whenever I run the upgrade for 4.0.1 to 4.1.0. The issue is below:
  
  ```
  Cannot execute CREATE TABLE `civicrm_setting` ( 
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 
  `group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'group name for setting element, useful in caching setting elements', 
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique name for setting', 
  `value` text COLLATE utf8_unicode_ci COMMENT 'data associated with this group / name combo', 
  `domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this menu item for', 
  `contact_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Contact ID if the setting is localized to a contact', 
  `is_domain` tinyint(4) DEFAULT NULL COMMENT 'Is this setting a contact specific or site wide setting?', 
  `component_id` int(10) unsigned DEFAULT NULL COMMENT 'Component that this menu item belongs to', 
  `created_date` datetime DEFAULT NULL COMMENT 'When was the setting created', 
  `created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this setting', 
  PRIMARY KEY (`id`), 
  KEY `index_group_name` (`group_name`,`name`), 
  KEY `FK_civicrm_setting_domain_id` (`domain_id`), 
  KEY `FK_civicrm_setting_contact_id` (`contact_id`), 
  KEY `FK_civicrm_setting_component_id` (`component_id`), 
  KEY `FK_civicrm_setting_created_id` (`created_id`), 
  CONSTRAINT `FK_civicrm_setting_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE, 
  CONSTRAINT `FK_civicrm_setting_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE, 
  CONSTRAINT `FK_civicrm_setting_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`), 
  CONSTRAINT `FK_civicrm_setting_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL ) 
  ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1: 
  DB Error: already exists
  
  ```
  
  **Tags:** upgrade
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-12. Score: 1
  
  The error you posted says, "Hi, I'm trying to create a new table in your database, but that table already exists."
  
  Most commonly, this happens when you do an upgrade, then restore a backup, then attempt the upgrade again. My guess is that you got a similar-looking (but different!) error previously, restored a backup, then got this on a second upgrade.
  
  The reason this happens is that restoring a backup puts OLD tables back the way they were, but doesn't touch any NEW tables that don't exist in the backup. So if you upgrade, you can NOT restore your database to the previous version simply by reloading the backup. You must first `DROP <database_name>` and `CREATE <databasename>` so that you're restoring to a clean slate.
  
  Try doing a DROP and CREATE before restoring your database and mark this question solved if that clears this error! If you have a separate error, please post that as a new question.
  
  
  ---
  
  ### Answer by username_2 on 2016-10-13. Score: 0
  
  First of all please take a backup of your currect version and then try the below against a test server
  
  Please try to upgrade from 4.0.1 to 4.0.8 first and then try upgrading to 4.1.0
  If you still get some issue then try upgrading to 4.0.1 to 4.0.4 and to 4.0.8 and finally to 4.1.0
  
  I guess this helps !!!
  
  > **Comments:**
  > **username_0**: Hi username_2 thank you.  It looks like I had to go 4.01, .02, .03, etc.  but when I got to 4.07, I couldn't run the upgrade script from 4.06.  4.07 upgrade is giving me "HTTP ERROR 500".  Any insight on this?  
  > **username_2**: make sure you have replaced the code base correctly - also please look for any civicrm error log - if nothing helps look for PHP error log - you should have some error - i guess this helps  
  
  ---
  
  