Guide for Mysql2 "Table already exists" error fix

The following guide will teach you how to solve the database Mysql2 table already exists error. It is a serious problem as Redmine crashes in general and could be related to any of our plugins.

If the problem appears at your Redmine, then the error logs (in the production.log file) should look like this:

Mysql2::Error: Table 'name_of_the_table' already exists: CREATE TABLE name_of_the_table

Note: The name_of_the_table depends on which plugin the error is appearing on.

The error itself means that the migration was broken some time ago. Please follow these steps to fix it:

Create a backup of the existing database

Stop the web-server to avoid new data adding while the migration is running

Drop table name_of_the_table from your database manually

Run plugin migration command again

Copy the data from the old table name_of_the_table to the new one

Start the webserver

Was this article helpful? Yes  No
152 from 185 found this helpful