DATABASECHANGELOGLOCK doesn't exist but also already exists

Thomas3 years ago

SELECT COUNT(*) FROM traccar.DATABASECHANGELOGLOCK = ERROR: Table 'traccar.DATABASECHANGELOGLOCK' doesn't exist

CREATE TABLE traccar.DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID)) = ERROR: Tablespace '`traccar'.'DATABASECHANGELOGLOCK' exists.

I have encountered this situation where the table doesn't exist but it also cant be created because it already exists.

Suggestions?

Anton Tananaev3 years ago

What database are you using? Have you tried it without explicitly specifying database name? Have you checked what the table name is in the database? Maybe it's case sensitive?

Thomas3 years ago

MySQL 5.7.31
Yes I have tried without database name
Yes ive checked the table name in the database
Ive tried both cases

Anton Tananaev3 years ago

Don't really have any other ideas. Can you provide access to the database?

Thomas3 years ago

I restored the traccar database from a backup and it worked. The DB must have become corrupt somehow?