How to set Foreign Key in mysql between Two different databases?

database, mysql

Solution

Any relationship between/among tables are confined within a schema. You cannot define foreign key constrain between two unrelated tables in two different schema. If you have a real need o do it then you need to re-think about your database design.

Problem

I have a database A and database B. In database A i set company_id as Primary key. In database B i have to set same company_id as a reference. Is it possible to set B.company_id as foreign key? If yes means how to set this B.company_id as foreign key?

Original source

Related problems