请教跨库外键约束问题
我有两个数据库,A有一个表userinfo,B有另外一个表homeImg,
use A;
create table userinfo
(
id int(10) unsigned primary key auto_increment,
....
)default charset=utf8;
use B;
create table homeImg
(
id int(10) unsigned primary key auto_increment,
userId int(10) unsigned,
KEY userId (userId),
CONSTRAINT homeimg_userinfofk_1 FOREIGN KEY (userId) REFERENCES A.userinfo(id)
)default charset=utf8;
执行的时候 提示,ERROR 1215 (HY000): Cannot add foreign key constraint.请问是怎么回事?是不是外键只能在同一个库中? 如何解决?
谢谢。