CodeCanyon

mySQL - Find and delete foreign key

29 posts
  • Has been a member for 1-2 years
  • Exclusive Author
  • Bought between 10 and 49 items
  • Denmark
mp3dk says

Greetings,

I am having trouble deleting two tables in my database due to a foreign key.

How do I find and key the foreign key? I’ve never seen this problem before. Thanks.

6 months ago
1703 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Community Moderator
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • Australia
  • Referred between 200 and 499 users
dtbaker says

Just keep trying to drop those two+ tables over and over again. That should get you past the foreign key issue.

6 months ago
dtbaker is a moderator
472 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 10 and 49 items
Thecodingdude says

Find the same row name in the other table.

So

Users: ID – primary key.

Posts: user_id -> foreign key.

Try and find that, or do as DB taker said. I believe you have to remove the primary key first before the foreign key (or the other way around).

6 months ago
1849 posts
  • Has been a member for 1-2 years
  • Interviewed on the Envato Notes blog
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 50 and 99 items
  • Australia
SportTipsWorld says

Pmsl at the typo , DB Taker

Thats gold

6 months ago
29 posts
  • Has been a member for 1-2 years
  • Exclusive Author
  • Bought between 10 and 49 items
  • Denmark
mp3dk says

Thank you all. I will try your suggestions :)

6 months ago
by
by
by
by
by