Page 1 of 1

[solved] MySQL error - duplicate entry

Posted: Mon Sep 08, 2008 8:59 am
by stopsatgreen
On Friday my WAMP server crashed and corrupted the MySQL files. I reinstalled all the files to get it running again and restored backup data, which seemed to do the trick; the site is back online and functioning as normal - except for one key problem. When I try to submit News stories I get the error:
Duplicate entry '0' for key 1
If I'm correct, I think this means the News module is trying to restart the ID numbering from 0, which is conflicting with existing stories. How can I stop this conflict?

I found that the news_id field in cms_module_news and set it to auto increment and that seems to have done the trick. Not sure why it stopped before.

Update: Reopening this as I have another problem. I can't assign multiple permissions on the Group Permissions page; when I do, I get the error:
FATAL: Duplicate entry '0' for key 1
This one can't be resolved by adding an auto increment. I've compared the MySQL settings with a live, functioning one, and they seem to be identical. Anyone help me out on this?

Re: MySQL error - duplicate entry

Posted: Tue Sep 09, 2008 11:16 am
by stopsatgreen
I've just noticed that my restored database doesn't have the module_xx_seq tables* any more - is this causing the error? Can I restore them?

* As seen in this post: http://forum.cmsmadesimple.org/index.ph ... 131.0.html

Re: MySQL error - duplicate entry

Posted: Tue Sep 09, 2008 6:56 pm
by NaN
If you know what Module needs sequence tables you just can create it by yourself.
But you need to know what value to insert there.
In the news module you just need to know the highest article and category id.
Insert in ..._seq table the highest id + 1.

It would be easier to reinstall the modules, update your database and adapt the values of the sequence tables cause you don't know what module needs what sequence tables.

Re: MySQL error - duplicate entry

Posted: Tue Sep 09, 2008 8:33 pm
by stopsatgreen
Not being a MySQL wizard, I created a new DB and installed a fresh copy of CMSMS into it, dropped all the tables that existed in my original DB, then transferred the new DB in; seems to have done the trick. Thanks.