mysql-error-1062

MyISAM unique keys being cut off at 64 bytes, causing collisions

老子叫甜甜 提交于 2019-12-07 05:11:08
问题 I've got a MySQL table that stores urls as unique keys. I'm starting to get collisions on my keys because it seems the keys themselves are only the first 64 bytes (or characters if you prefer, its a latin-1 collated) of any url. So if a url is over 64 characters and I've already got a similar url it throws an error. For example: SELECT l.link_id FROM mydb.links l WHERE url = 'http://etonline.com/tv/108475_Charlie_Sheen_The_People_Have_Elected_Me_as_Their_Leader/index.html' Throws this error:

Error Code: 1062. Duplicate entry 'PRIMARY'

心已入冬 提交于 2019-12-07 04:24:57
问题 So, my professor gave me tables to insert it in a database but when I execute his code, MySQL is constantly giving the Error Code: 1062. Here is the conflict tables and the inserts: TABLES CREATE TABLE FABRICANTES( COD_FABRICANTE integer NOT NULL, NOMBRE VARCHAR(15), PAIS VARCHAR(15), primary key (cod_fabricante) ); CREATE TABLE ARTICULOS( ARTICULO VARCHAR(20)NOT NULL, COD_FABRICANTE integer NOT NULL, PESO integer NOT NULL , CATEGORIA VARCHAR(10) NOT NULL, PRECIO_VENTA integer, PRECIO_COSTO

Catch MySQL error in c++

限于喜欢 提交于 2019-12-06 15:11:35
In C++, I am using mysql.h libraries and I do not manage to catch MySQL errors (for example, failure to insert due to conflict in primary key). I have tried #include <mysql.h> // ... try{ res = mysql_perform_query(conn, sqlIn); } catch (...) { // ... } but it still does not avoid aborting with: MySQL query error : Duplicate entry I am running the compiled c++ program using PuTTy interface and as the program aborts, it reproduces MySQL's error (regardless of whether I use TRY CATCH or not). I have not found any reference to specific exception codes for MySQL use with catch statement. Apparently

Comparing strings in PHP the same way MySQL does

女生的网名这么多〃 提交于 2019-12-06 00:51:12
问题 I'm storing a varchar in a utf8 MySQL table and using utf8_general_ci collation. I have a unique index on the varchar. I'd like to do a string comparison in PHP that is equivalent to what MySQL will do on the index. A specific example is that I'd like to be able to detect that 'a' is considered equivalent to 'À' in PHP before this happens: mysql> insert UniTest (str) values ('a'); Query OK, 1 row affected (0.00 sec) mysql> insert UniTest (str) values ('À'); ERROR 1062 (23000): Duplicate entry

phpMyAdmin: MySQL Error 1062 - Duplicate entry

不问归期 提交于 2019-12-05 22:22:21
I connect with user "root" onto my database "test" which I host locally for development. Among others I have the table "ratingcomment". For some reason when I click on the table "ratingcomment" phpMyAdmin shows me the following error: Fehler SQL-Befehl: INSERT INTO `phpmyadmin`.`pma_history` ( `username` , `db` , `table` , `timevalue` , `sqlquery` ) VALUES ( 'root', 'test', 'ratingcomment', NOW( ) , 'SELECT * FROM `ratingcomment`' ) MySQL meldet: #1062 - Duplicate entry '838' for key 'PRIMARY' I used google to finde out the following "This indicates that you have a UNIQUE or PRIMARY index on a

Magento — “SQLSTATE[23000]: Integrity constraint violation..” on customer update

[亡魂溺海] 提交于 2019-12-05 10:07:10
After migrating servers, I'm getting an error every time I try to update customer information. I'm using a customer activation plugin , but after disabling it, I still get the same error. SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '7-127' for key 2 What is wrong? Even after uninstalling the plugin, I get this error while trying to save customer information. So this leads me to believe its a bigger problem with Magento and/or the server I'm switched to. I checked the Magento's log and I'm getting this Notice multiple times: ERR (3): User Notice: Sorry, your PCRE

MyISAM unique keys being cut off at 64 bytes, causing collisions

故事扮演 提交于 2019-12-05 08:25:30
I've got a MySQL table that stores urls as unique keys. I'm starting to get collisions on my keys because it seems the keys themselves are only the first 64 bytes (or characters if you prefer, its a latin-1 collated) of any url. So if a url is over 64 characters and I've already got a similar url it throws an error. For example: SELECT l.link_id FROM mydb.links l WHERE url = 'http://etonline.com/tv/108475_Charlie_Sheen_The_People_Have_Elected_Me_as_Their_Leader/index.html' Throws this error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'http://etonline.com/tv/108475

Foreign key constraints while dumping data

。_饼干妹妹 提交于 2019-12-04 06:59:43
问题 mysqldump --compact --no-create-info -h192.168.150.180 -uroot -p live pnlbus_stops | sed s/pnlbus_stops/bus_stops/g | mysql test I am getting an error: ERROR 1062 (23000) at line 1: Duplicate entry 'AN' for key 1 This is because bus_stops table in the test DB has foreign key constraints. How do I truncate the bus_stops table from test database in a SINGLE STATEMENT before inserting from "live" DB? 回答1: put set FOREIGN_KEY_CHECKS = 0; at the top of your dump file and put SET FOREIGN_KEY_CHECKS

Comparing strings in PHP the same way MySQL does

你离开我真会死。 提交于 2019-12-04 05:31:20
I'm storing a varchar in a utf8 MySQL table and using utf8_general_ci collation. I have a unique index on the varchar. I'd like to do a string comparison in PHP that is equivalent to what MySQL will do on the index. A specific example is that I'd like to be able to detect that 'a' is considered equivalent to 'À' in PHP before this happens: mysql> insert UniTest (str) values ('a'); Query OK, 1 row affected (0.00 sec) mysql> insert UniTest (str) values ('À'); ERROR 1062 (23000): Duplicate entry 'À' for key 1 The collation has nothing to do with the storage. You need to set the charset to

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

帅比萌擦擦* 提交于 2019-12-04 00:21:49
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) { $title = $_POST['txtTitle']; $txtParentCategorie = $_POST['txtParentCategorie']; $txtContent = $_POST['txtContent']; if($txtParentCategorie == "niks") { $txtParentCategorie = NULL; $chkParent = 1; $order_count = countQuery("SELECT categorieID FROM prod_categorie WHERE parentID=?",array(1)); $order = $order_count + 1; } else { $chkParent = null; $order