<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>

CC BY-SA 3.0
2017-10-12T18:17:53.723Z
2017-10-12T18:17:53.723Z
Michael Witwicki
<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>

CC BY-SA 3.0
2017-10-10T19:59:05.633Z
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?
Brad Bell
CC BY-SA 3.0
2017-10-10T20:04:43.137Z
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.
Michael Witwicki
CC BY-SA 3.0
2017-10-10T20:07:49.367Z
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.
Brad Bell
CC BY-SA 3.0
2017-10-10T20:20:08.270Z
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.
Michael Witwicki
CC BY-SA 3.0
2017-10-10T21:33:12.233Z
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 }`
Brad Bell
<field><mysql>
Base table or view already exists
# 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 @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.  
> **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 @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.  
> **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.


---

