Having trouble adding a foreign key in HeidiSQL (Error 1215)

Viewed 61

I've tried just about everything but I'm getting error 1215 when trying to create a foreign key in a child table I have. Here are my tables:

CREATE TABLE `Con` (
  `ConID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `Website` varchar(500) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `FirstYear` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`ConID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

CREATE TABLE `ConEvent` (
  `EventID` int(11) NOT NULL AUTO_INCREMENT,
  `ConID` int(11) NOT NULL,
  `DateStart` date DEFAULT NULL,
  `DateEnd` date DEFAULT NULL,
  `Year` tinyint(4) DEFAULT NULL,
  `Venue` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Address` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `City` tinytext COLLATE utf8_unicode_ci,
  `StateProvince` tinytext COLLATE utf8_unicode_ci,
  `Country` tinytext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`EventID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Here is my syntax:

ALTER TABLE ConEvent
ADD FOREIGN KEY (ConID) REFERENCES Con(ConID);

I can't SHOW ENGINE INNODB STATUS; because I'm not a super user (error 1227). I tried to make myself one but was unable to.

0 Answers
Related