Answers.Body: <p>This turned out to be an issue with the mysql server itself, not a Craft CMS issue at all. </p>
  
  <p>It appears that during a previous field addition, the database server crashed and left hanging temporary files that didn't match with the database itself.</p>
  
  <p>Spun up a new database, copied the DB over and everything worked as expected. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-12T18:17:53.723Z
Answers.LastActivityDate: 2017-10-12T18:17:53.723Z
Answers.UserDisplayName: Michael Witwicki
Body: <p>Getting the following error on production environment when trying to add a new Field.</p>
  
  <blockquote>
    <p>CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'redacted' already exists</p>
  </blockquote>
  
  <p>Anyone have any idea what could be causing this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-10T19:59:05.633Z
Comments.Text: Is it a Matrix field you're trying to add and is the handle `redacted`? If so, does a table named `redacted` already exist in the database?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-10T20:04:43.137Z
Comments.Text: Hey @BradBell, 
  
  Just a regular Plain Text field (not Matrix). I just put "redacted" in there because the table contained info that made the hosting environment evident. It actually says:
  
  Table '[name-of-hosting-provider]/#sql-ib450' already exists.
  
  Not sure what the 'sql-ib450' is all about.
Comments.UserDisplayName: Michael Witwicki
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-10T20:07:49.367Z
Comments.Text: Weird... can you enabled devMode then share the full stack trace leading up to the error?  Wondering if a plugin is getting involved.  Craft won't create a new table for a Plain Text field.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-10T20:20:08.270Z
Comments.Text: Sure thing @BradBell - where will I find the log you are looking for? This is on production so I want to limit the time the [devMode] is in the title tags.
  
  It's worth noting that I CANNOT replicate this issue on my local or development environments.
Comments.UserDisplayName: Michael Witwicki
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-10T21:33:12.233Z
Comments.Text: You could conditionally enable devMode from your IP address in `craft/config/general.php`... something like `if ($_SERVER['REMOTE_ADDR'] == '1.2.3.4') { 'devMode' => true }`
Comments.UserDisplayName: Brad Bell
Tags: <field><mysql>
Title: Base table or view already exists
ThreadText: # Base table or view already exists
  
  (Asked by: username_0 on 2017-10-10)
  
  Getting the following error on production environment when trying to add a new Field.
  
  > CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'redacted' already exists
  
  Anyone have any idea what could be causing this?
  
  **Tags:** field, mysql
  
  > **Comments:**
  > **username_1**: Is it a Matrix field you're trying to add and is the handle `redacted`? If so, does a table named `redacted` already exist in the database?  
  > **username_0**: Hey @username_1,   Just a regular Plain Text field (not Matrix). I just put "redacted" in there because the table contained info that made the hosting environment evident. It actually says:  Table '[name-of-hosting-provider]/#sql-ib450' already exists.  Not sure what the 'sql-ib450' is all about.  
  > **username_1**: Weird... can you enabled devMode then share the full stack trace leading up to the error?  Wondering if a plugin is getting involved.  Craft won't create a new table for a Plain Text field.  
  > **username_0**: Sure thing @username_1 - where will I find the log you are looking for? This is on production so I want to limit the time the [devMode] is in the title tags.  It's worth noting that I CANNOT replicate this issue on my local or development environments.  
  > **username_1**: You could conditionally enable devMode from your IP address in `craft/config/general.php`... something like `if ($_SERVER['REMOTE_ADDR'] == '1.2.3.4') { 'devMode' => true }`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-10-12. Score: 2
  
  This turned out to be an issue with the mysql server itself, not a Craft CMS issue at all.
  
  It appears that during a previous field addition, the database server crashed and left hanging temporary files that didn't match with the database itself.
  
  Spun up a new database, copied the DB over and everything worked as expected.
  
  
  ---
  
  