title: Cannot creat foreign key mysql
body: <p>I am trying to  creat a foreign  key  as this code bellow, but I am getting the follow error, I did already check the fields and it has the same type as you can see <strong>int(6) not null</strong> but I am still getting this erro</p>
  
  <p><strong>#1005 - Cannot creat table unicesumar.br_funcionarios (erro no. 150 "Foreign key constraint is incorrectly formed")</strong></p>
  
  <pre><code>CREATE TABLE `br_users` (
    `ID` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `COD_USER` int(6) NOT NULL,
    `SUPERIOR` int(6) DEFAULT NULL,
    `AREA` int(11) DEFAULT NULL,
    `SENHA` varchar(32) DEFAULT NULL,
    `ATIVO` int(1) NOT NULL
  );
  
  CREATE TABLE `br_funcionarios` (
   `ID` int(11) PRIMARY KEY AUTO_INCREMENT,
   `COD_USER_FK` int(6) NOT NULL,
   `CPF` int(11) DEFAULT NULL,
   `RG` varchar(15) DEFAULT NULL,
   `TELEFONE` varchar(255) DEFAULT NULL,
   `ENDERECO` varchar(255) DEFAULT NULL,
   `EMAIL` varchar(255) DEFAULT NULL,
   `CTP` varchar(50) DEFAULT NULL,
   `NOME` varchar(255) DEFAULT NULL,
    FOREIGN KEY(COD_USER_FK) REFERENCES BR_USERS(COD_USER)
  )
  </code></pre>
  
  <p>I am using mysql on xampp via phpMyAdmin
  I already googled about it but I am still stuck on this situation
  could some one help me thanks</p>