Create foreign key in PHPMYADMIN online

1

I created my project tables using the mysql workbench , but when I put online the phpmyadmin does not register the foreign keys. How can I solve this problem?

It gives the following error when creating a table:

  

1005 - Can not create table 'borinire_represents_new. # sql-1be5_1d12aa5' (errno: 121)

Keys:

Limiters for table agendamentos :

ALTER TABLE 'agendamentos'
  ADD CONSTRAINT 'fk_cliente' FOREIGN KEY ('cliente_id') REFERENCES 'clientes' ('clientes_id');

Limiters for table clientes :

ALTER TABLE 'clientes'
  ADD CONSTRAINT 'fk_categoria' FOREIGN KEY ('categoria_id') REFERENCES 'categorias' ('categorias_id');

Limiters for table municipios :

ALTER TABLE 'municipios'
  ADD CONSTRAINT 'fk_estados' FOREIGN KEY ('estados_id') REFERENCES 'estados' ('estados_id');


COMMIT;
    
asked by anonymous 08.11.2017 / 12:32

1 answer

0

For your sql you are changing a table that already exists correct? From that point, error 121 means that you have a duplicate key, so you would have to check for duplicate key in the fields you are trying to add to the foreign key constraint.

    
08.11.2017 / 12:55