After updating (I've also applied patches) from 1.1beta7 to 1.1 final, I've got strange errors when the web frontend tries to manipulate the DB.
errors like this:
SQL error: Duplicate entry '0' for key 1
Query: insert into profiles (userid,idx,value,valuetype) values (1,'web.latest.groupbyapp','1',0)
if I use that command inside the console of mysql, it obviusly returns the same error, but if I use it inside the console using also the primary key, it works perfectly.
For example:
insert into zabbix.profiles (profileid,userid,idx,value,valuetype) values (11,1,'web.latest.groupbyapp','1',0);
where "profileid" is the primary key and "11" is its value for this row.
In this case the error is because of a UNIQUE KEY in the db.
Obviously I could not insert all the commands by hand, so I did this: dropped the DB, modified the previous databease-dump (I have it backupped) by changing all "UNIQUE KEY" into simple "KEY", and then I re-created zabbix database and imported the modified dump.
Result: now it works for some tables (and so some frontend webpages don't give errors anymore), but there are still some tables (for example 'alarms' and 'functions') that return that error (and so some frontend webpages still give errors), because the problem is the PRIMARY KEY.
BUT, if I set all "PRIMARY KEY" to "KEY", when the web frontend puts new rows into database tables, obviously the index number ('alarmid', 'functionid', and so on) isn't increased, screwing up the database.
What can I do? Why do I have this errors on unique/primary keys? Maybe I have not configured mysql properly?
Thanks to anybody that will answer.
PS: I've got Mysql 4.1.20 on CentOS 4.3
errors like this:
SQL error: Duplicate entry '0' for key 1
Query: insert into profiles (userid,idx,value,valuetype) values (1,'web.latest.groupbyapp','1',0)
if I use that command inside the console of mysql, it obviusly returns the same error, but if I use it inside the console using also the primary key, it works perfectly.
For example:
insert into zabbix.profiles (profileid,userid,idx,value,valuetype) values (11,1,'web.latest.groupbyapp','1',0);
where "profileid" is the primary key and "11" is its value for this row.
In this case the error is because of a UNIQUE KEY in the db.
Obviously I could not insert all the commands by hand, so I did this: dropped the DB, modified the previous databease-dump (I have it backupped) by changing all "UNIQUE KEY" into simple "KEY", and then I re-created zabbix database and imported the modified dump.
Result: now it works for some tables (and so some frontend webpages don't give errors anymore), but there are still some tables (for example 'alarms' and 'functions') that return that error (and so some frontend webpages still give errors), because the problem is the PRIMARY KEY.
BUT, if I set all "PRIMARY KEY" to "KEY", when the web frontend puts new rows into database tables, obviously the index number ('alarmid', 'functionid', and so on) isn't increased, screwing up the database.
What can I do? Why do I have this errors on unique/primary keys? Maybe I have not configured mysql properly?
Thanks to anybody that will answer.
PS: I've got Mysql 4.1.20 on CentOS 4.3


Comment