title: MySQL weird error. duplicate entry for primary key
body: <p>I got sql error today: </p>
  
  <blockquote>
    <p>Duplicate entry '10639' for key 'PRIMARY'INSERT INTO site_plugin_redirects_stats (stat_redirect,stat_date,stat_from,stat_ip) VALUES ( 0,1489571042,'','::1');</p>
  </blockquote>
  
  <p>site_plugin_redirects_stats has as primary key stat_id with auto-increment, bellow is the create statement:</p>
  
  <pre><code>CREATE TABLE 'site_plugin_redirects_stats' (
    'stat_id' int(11) NOT NULL AUTO_INCREMENT,
    'stat_redirect' int(11) NOT NULL,
    'stat_date' int(11) NOT NULL,
    'stat_from' text NOT NULL,
    'stat_ip' varchar(30) NOT NULL,
    'stat_hostname' varchar(255) NOT NULL,
    PRIMARY KEY ('stat_id')
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>The error i receive should never happen, but i encountered it twice in the past 6 months. </p>
  
  <p>The problem is once i receive it the application will stop running, no other records can be inserted in that table. </p>
  
  <p>Is something related to mysql configuration ? a bug or something maybe ? </p>
  
  <p>First time it happened on a production LAMP server, second time on a local WAMP server.</p>