ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

No joy when manually auto-incrementing exp_cp_log

May 21, 2010 12:25pm

Subscribe [3]
  • #1 / May 21, 2010 12:25pm

    Pigtail Dencil

    117 posts

    The windows server that was hosting my client’s site was struck by an electrical outage - call it divine intervention. The hosts couldn’t recover the db, so I supplied them a backup. They imported it into a fresh db and put us on a (proper) Linux machine to boot.

    Besides the server paths needing some tlc, I got a load of db errors (Error Number: 1062, Duplicate entry ‘0’ for key 1) when logging in and performing various tasks. In short, the auto-increment setting in the imported db had somehow forgotten itself much as described here and here.

    So off to work I went updating each field as suggested here. Problem is that updating the field id in my exp_cp_log returns:

    SQL query:
    
    ALTER TABLE `exp_cp_log` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT
    
    MySQL said: Documentation
    #1062 - Duplicate entry '1' for key 1

    Any clues?

    We’re running 1.6.8 ~ 20091201

    Big thanks,

    Seb

  • #2 / May 21, 2010 3:34pm

    Sue Crocker

    26054 posts

    Seb, I’d probably do the following:

    DROP TABLE IF EXISTS `exp_cp_log`;
    CREATE TABLE `exp_cp_log` (
      `id` int(10) NOT NULL AUTO_INCREMENT,
      `site_id` int(4) unsigned NOT NULL DEFAULT '1',
      `member_id` int(10) unsigned NOT NULL,
      `username` varchar(32) COLLATE utf8_bin NOT NULL,
      `ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
      `act_date` int(10) NOT NULL,
      `action` varchar(200) COLLATE utf8_bin NOT NULL,
      PRIMARY KEY (`id`),
      KEY `site_id` (`site_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;

    The last line might be different depending on your server settings.

    Does that help?

  • #3 / May 22, 2010 3:46am

    Pigtail Dencil

    117 posts

    Sue, you’re a star! That worked a treat.

    Mucho thank you.

    Seb

  • #4 / May 22, 2010 4:20pm

    Greg Salt

    3988 posts

    Hi Seb,

    Glad that Sue was able to help you get this sorted. Please post back if required.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases