MySQL InnoDB foreign key between different databases

Alaa picture Alaa · Oct 11, 2010 · Viewed 34.4k times · Source

I would like to know if it's possible in InnoDB in MySQL to have a table with foreign key that references another table in a different database ?

And if so, how this can be done ?

Answer

BarsMonster picture BarsMonster · Oct 11, 2010

I do not see any limitation on https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html.

So just use otherdb.othertable and you will be good.