MySQL InnoDB foreign key between different databases
It's possible : Link to do it
Example (Table1 is in database1 and HelloTable is in database2) :
ALTER TABLE Table1
ADD foreign key FK_table1(ColumnNameFromTable1)
REFERENCES db2.HelloTable(ColumnNameFromHelloTable)
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.