title: MySQL foreign key constraint error code 1215
body: <p>Can anyone see the problem with my create statement for table contactgroup. I keep getting error code 1215 can't create foreign key constraint.</p>
  
  <pre><code>create table contact( 
  ContactID int(5) not null auto_increment, 
  ContactName varchar(255) Not null, 
  ContactNumber int(5), 
  ContactEmail varchar(255), 
  primary key(ContactID))ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <hr>
  
  <pre><code>create table contactgroup(
  ContactGroupID int(5) Not Null,
  ContactID int(5) Not Null,
  primary key(ContactGroupID),
  key fk_contactgroup_ContactID (ContactID),
  constraint fk_contactgroup_ContactID 
  foreign key(ContactID) 
  references contact) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>