MySQL Forums
Forum List  »  Newbie

Can't create foreign key due to err 1050
Posted by: Chess Dad
Date: September 04, 2015 09:22AM

Hello,

I'm trying to create some foreign keys in a table called its_equip_location. However, when I try to create the key I get the following error:

Table './itsdb/its_@0020equip_location' already exists

I have tried deleting the its_equip_location table and recreating it but I get the same error. I've tried DROP IF EXIST its_@0020equip_location but get the following error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@0020equip_location' at line 1

In my research I found an article that said that possibly I have an orphaned table in my dictionary (I don't know what that is but ok). The article recommended I create a temporary database and move the tables from the original db to the temp db, delete the orig db and recreate it, then move the tables back to the newly created db.

I created a temp db called tempdb but I can't find a "move" function to move the tables. The original db is called itsdb. I'd have to move the tables to tempdb, delete itsdb, recreate itsdb, then move the tables back.

As you can see from my post I'm very new with MYSQL. Is this even a good method? Is there an easier method? Everything is backed up so I'm not afraid of trial and error. I just want to be able to create the necessary foreign keys.

Thanks for you help and suggestions.
Chris.

Options: ReplyQuote


Subject
Written By
Posted
Can't create foreign key due to err 1050
September 04, 2015 09:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.