Problem inserting unique MySQL record

3

I have a table that has a unique field, a record of this table has been deleted and now I want to insert it again, however MySQL generates the error: "Error Code: 1062. Duplicate entry '' for key ' '". How can I solve this?

CREATE TABLE:

CREATE TABLE 'bem' (
  'id' int(11) unsigned NOT NULL AUTO_INCREMENT,
  'cpf' varchar(17) NOT NULL,
  ...
  PRIMARY KEY ('id'),
  UNIQUE KEY 'cpf' ('cpf')
) ENGINE=InnoDB AUTO_INCREMENT=1764 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;

INSERT EXAMPLE:

INSERT INTO 'bem' (cpf, ...)VALUES ('12312312312', ...);
    
asked by anonymous 07.07.2016 / 15:17

1 answer

0

Try to run the MySQL table repair.

If it is a table using the InnoDb engine, just do this ALTER TABLE that it will undergo a rebuild :

mysql> ALTER TABLE t1 ENGINE = InnoDB;

If it is a MyISAM , just do:

mysql> REPAIR TABLE t1;
    
07.07.2016 / 17:13