title: Mysql creates index instead of foreign key constraint
body: <p>I am trying to create an foreign key constraint between two tables but after I execute the alter command mysql creates index instead of foreign key.</p>
  <p>I am using hibernate, so initially i thought this to be a problem of hibernate but when i execute the query directly on mysql behavior is same.</p>
  <blockquote>
  <p>alter table person add constraint FK9ircw28d19mdg5pu8yfg1qs8p foreign key (Address_Id) references Address (Address_Id)</p>
  </blockquote>
  <p>After running this command, i get following in mysql database</p>
  <p><a href="https://i.stack.imgur.com/Ibql1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ibql1.png" alt="enter image description here" /></a></p>
  <p>As you can see constraint is added in indexes rather than as Foreign key.</p>
  <p>Hibernate executes following queries while creating tables:</p>
  <blockquote>
  <p>Hibernate: drop table if exists Address</p>
  <p>Hibernate: drop table if exists hibernate_sequence</p>
  <p>Hibernate: drop table if exists person</p>
  <p>Hibernate: create table Address (Address_Id bigint not null, addressLine1 varchar(255), addressLine2 varchar(255), city varchar(255) not null, country varchar(255) not null, state varchar(255) not null, primary key (Address_Id)) engine=MyISAM</p>
  <p>Hibernate: create table hibernate_sequence (next_val bigint) engine=MyISAM</p>
  <p>Hibernate: insert into hibernate_sequence values ( 1 )</p>
  <p>Hibernate: insert into hibernate_sequence values ( 1 )</p>
  <p>Hibernate: create table person (Person_Id bigint not null, dob date not null, name varchar(255) not null, Address_Id bigint, primary key (Person_Id)) engine=MyISAM</p>
  <p>Hibernate: alter table person add constraint FK9ircw28d19mdg5pu8yfg1qs8p foreign key (Address_Id) references Address (Address_Id)</p>
  </blockquote>