1.  两个表必须都是 ENGINE=InnoDB
2. 必须按照严格的外键语法编写.

示例:
CREATE TABLE `family` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

CREATE TABLE `member` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) DEFAULT NULL,
  `family_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `family_fk` (`family_id`),
  CONSTRAINT `family_fk` FOREIGN KEY (`family_id`) REFERENCES `family` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

或可写作匿名外键:
CREATE TABLE family (
  id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name varchar(200)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

CREATE TABLE member (
  id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name varchar(200) DEFAULT NULL,
  family_id int(11) NOT NULL,
  FOREIGN KEY (family_id) REFERENCES family(id)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;