1. Home
  2. Knowledge Base
  3. Articles (EN/ES/FR)
  4. Pandora FMS crashes and the log message says “DBD::mysql::db do failed: Duplicate entry ‘1808516’ for key ‘PRIMARY'”

Pandora FMS crashes and the log message says “DBD::mysql::db do failed: Duplicate entry ‘1808516’ for key ‘PRIMARY'”

Your MySQL database has been corrupted and the auto-incremental field has been desynchronized. To solve this, just update the last value of the auto-incremental field that the table has problems with:

alter table xxxxx Auto_increment = 1234;

Where “1234” is a highest value possible + 2. You can get this value for example with:

select MAX(primary_key_field) FROM xxxxx;

In Pandora FMS most table corruption should happen in tagente_datos, tagent_access, tagente_datos_string or tevento. This could be an example on how to fix the problem in the tagente_datos_string:

 mysql> select max(id_tagente_datos_string) from tagente_datos_string;
 | max(id_tagente_datos_string) |
 |                      1900270 |
alter table tagente_datos_string Auto_increment = 1900272;

In the MySQL Cluster problems are related with a bad sync between nodes:

If this doesn’t fix the problem, try to use these settings on the SQL Node, editing your my.cnf file:


This also can happen because a table has a primary key with auto increment and has a very small top limit:

For example: tsesion is defined by default with int(4) this could be too low for huge systems, to fix this, just alter table to set more allocatable PK:

alter table tsesion modify ID_sesion bigint(20) unsigned;
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support