Questions tagged [mysql-error-1062]

ERROR 1062 (23000): Duplicate entry '%s' for key '%s'

ERROR 1062 (23000): Duplicate entry '%s' for key '%s'

121 questions
110
votes
15 answers

Problems with contenttypes when loading a fixture in Django

I am having trouble loading Django fixtures into my MySQL database because of contenttypes conflicts. First I tried dumping the data from only my app like this: ./manage.py dumpdata escola > fixture.json but I kept getting missing foreign key…
gerdemb
  • 10,547
  • 15
  • 62
  • 71
55
votes
9 answers

MySql can't make column auto_increment

I have a table "Bestelling" with 4 columns: "Id" (PK), "KlantId", "Datum", "BestellingsTypeId", now I want to make the column Id auto_increment, however, when I try to do that, I get this error: ERROR 1062: ALTER TABLE causes auto_increment…
Sander Declerck
  • 2,117
  • 4
  • 25
  • 36
38
votes
6 answers

How to skip row when importing bad MySQL dump

Given bad mysqldump that causes error on import: namtar backups # mysql -p < 2010-12-01.sql Enter password: ERROR 1062 (23000) at line 8020: Duplicate entry 'l�he?' for key 'wrd_txt' Is there an easy way to tell import to just skip given row and…
Almad
  • 5,357
  • 6
  • 28
  • 46
35
votes
8 answers

Error Code: 1062. Duplicate entry '1' for key 'PRIMARY'

I have a problem on this error message, when i try this: INSERT INTO `PROGETTO`.`UFFICIO-INFORMAZIONI` (`ID`, `viale`, `num_civico`, `data_apertura`, `data_chiusura`, `orario_apertura`, `orario_chiusura`, `telefono`, `mail`, `web`, `Nome-paese`,…
FrancescoN
  • 1,766
  • 7
  • 28
  • 40
30
votes
15 answers

MySQL duplicate entry error even though there is no duplicate entry

I am using MySQL 5.1.56, MyISAM. My table looks like this: CREATE TABLE IF NOT EXISTS `my_table` ( `number` int(11) NOT NULL, `name` varchar(50) NOT NULL, `money` int(11) NOT NULL, PRIMARY KEY (`number`,`name`) ) ENGINE=MyISAM; It contains…
user1763581
  • 525
  • 1
  • 7
  • 16
22
votes
9 answers

#1062 - Duplicate entry for key 'PRIMARY'

So my MySQL database is behaving a little bit wierd. This is my table: Name shares id price indvprc cat 2 4 81 0 goog 4 4 20 20 fb 4 9 20 20 I'm getting this #1062 error when I try to insert into the table.…
irosenb
  • 688
  • 2
  • 11
  • 26
17
votes
7 answers

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1922-1' for key 'IDX_STOCK_PRODUCT'

While creating product, at the last step after retrieving for a time, Magento gives following error-: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1922-1' for key 'IDX_STOCK_PRODUCT' What I am doing is, by capturing…
Prat
  • 509
  • 5
  • 16
  • 33
16
votes
2 answers

Converting mysql tables from latin1 to utf8

I'm trying to convert some mysql tables from latin1 to utf8. I'm using the following command, which seems to mostly work. ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; However, on one table I get an error about a…
Brent Baisley
  • 12,441
  • 2
  • 21
  • 39
14
votes
5 answers

Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'

I have a databse problem where i get Integrity constraint violation: 1062. I tried some things on my own but it didtn work so now i am asking you guys to see if you people can help me out. elseif($action == 'add') { if($_POST['create'] == true) { …
12
votes
6 answers

MySQL Binary Log Replication: Can it be set to ignore errors?

I'm running a master-slave MySQL binary log replication system (phew!) that, for some data, is not in sync (meaning, the master holds more data than the slave). But the slave stops very frequently on the slightest MySQL error, can this be disabled?…
mauriciopastrana
  • 4,804
  • 7
  • 30
  • 36
11
votes
1 answer

Mysql unique index doesn't work on a certain umlaut

I have a users table in which there's a column called 'nickname', utf-8 encoded, varchar(20), the table is in InnoDB. There're 2 records one has a nickname = 'gunni' and the other nickname = 'günni'. When I tried to apply a unique index onto this…
Shawn
  • 28,051
  • 17
  • 43
  • 68
9
votes
3 answers

MySQL ON DUPLICATE KEY insert into an audit or log table

Is there a way to accomplish this? INSERT IGNORE INTO some_table (one,two,three) VALUES(1,2,3) ON DUPLICATE KEY (INSERT INTO audit_table VALUES(NOW(),'Duplicate key ignored') I really don't want to use PHP for this :( Thanks!
ricardocasares
  • 499
  • 2
  • 10
  • 18
8
votes
3 answers

MySQL Duplicate error with ALTER IGNORE TABLE

I have a table in my MySQL with duplicates. I try to delete the duplicates and keep one entry. I don't have a primary key I can finde the duplicates by: select user_id, server_id, count(*) as NumDuplicates from user_server group by user_id,…
blubbering
  • 317
  • 5
  • 15
7
votes
2 answers

Problem loading Django fixture: IntegrityError: (1062, "Duplicate entry '4' for key 'user_id'")

I used the following commands to generate 2 fixtures: ./manage.py dumpdata --format=json --indent=4 --natural auth.User > fixtures/user.json ./manage.py dumpdata --format=json --indent=4 --natural --exclude=contenttypes --exclude=auth >…
Seán Hayes
  • 3,472
  • 3
  • 27
  • 42
7
votes
1 answer

Getting duplicate entry errors from Hibernate, is MySQL to blame?

I am working on a database application which is mostly read-only, but there is one table which records user movement in the app and has a large number of writes to it. For every few thousand writes, we see a few exceptions in the error log like…
Nik Reiman
  • 36,184
  • 26
  • 100
  • 159
1
2 3
8 9