I am trying to create a foreign key.

The columns in both tables are VARCHAR(255) and neither is a PK, however I keep getting this error message:

I can’t figure out how to make a fk out of the topics title and the posts’s topic_title.
Thank you in advance for your help, much needed.
Have a very nice day, Ana
Only define foreign keys to primary keys. That is simply a best practice.
In order to add a foreign key in MySQL, though, you need to declare the column in the referred table as a primary key, as
unique, or using an index. I strongly discourage you from using just any key. At the very least it should beunique. But preferably a primary key.