Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    151
    Plugin Contributions
    0

    help question 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    Website with the issue www(dot)sullivanvitamins(dot)com Note the website is down for maintenance.

    My hosting company upgraded their PHP on Sunday and when I went to my website on Monday I got many depricated errors as my shopping cart was outdated. I have installed the latest version of Zen Cart 1.5.1 but I'm having trouble accessing store data whether it be categories/products on the main page or in the admin customers/orders. I've tried importing my sql from my backup I did on Monday but get the following errors listed below.

    PHP Code:
    Error

    SQL query
    :

    --
    -- 
    Dumping data for table `address_format`
    --
    INSERT INTO `address_format` ( `address_format_id` , `address_format` , `address_summary` )
    VALUES 1'$firstname $lastname$cr$streets$cr$city, $postcode$cr$statecomma$country''$city / $country' ) , ( 2'$firstname $lastname$cr$streets$cr$city, $state $postcode$cr$country''$city, $state / $country' ) , ( 3'$firstname $lastname$cr$streets$cr$city$cr$postcode - $statecomma$country''$state / $country' ) , ( 4'$firstname $lastname$cr$streets$cr$city ($postcode)$cr$country''$postcode / $country' ) , ( 5'$firstname $lastname$cr$streets$cr$postcode $city$cr$country''$city / $country' ) , ( 6'$firstname $lastname$cr$streets$cr$city$cr$state$cr$postcode$cr$country''$postcode / $country' ) ;

    MySQL saidDocumentation
    #1062 - Duplicate entry '1' for key 'PRIMARY' 
    Then I tried importing in phpMYADMIN the same file again and I got this error afterwards. What I'm I doing wrong?

    PHP Code:
    Error

    SQL query
    :

    -- -- 
    Dumping data for table `address_book` -- INSERT INTO `address_book` (`address_book_id`, `customers_id`, `entry_gender`, `entry_company`, `entry_firstname`, `entry_lastname`, `entry_street_address`, `entry_suburb`, `entry_postcode`, `entry_city`, `entry_state`, `entry_country_id`, `entry_zone_id`) VALUES (11'm'NULL'***''***'', '***'''''***'', '***''''22312), (22'f'NULL'***'', '***'''***'', '', '***'''***'', '', 223, 12), (3, 3, 'm', NULL, '***'''***'', '***'''''***''***'''13183), (44'f'NULL'***''***''***''''***''***'''22362), (55'm'NULL'***''***''***''''***''***'''22318), (66'f'NULL'***''***''***''''***''***'''2234), (74'f'NULL'***''***''***''''***''***,'[...]

    MySQL saidDocumentation
    #1062 - Duplicate entry '1' for key 'PRIMARY' 

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    Evidently your backup doesn't contain any "DROP TABLE" statements for the data you're trying to import. Thus it's trying to import duplicates, which are what's triggering the errors.

    Either drop all the existing tables manually, or re-export your old data and choose the "Include DROP TABLES IF EXIST" option in the settings.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Apr 2007
    Posts
    151
    Plugin Contributions
    0

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    I reinstalled and got "Import has been successfully finished,... " but I don't see any data on either the public or admin side of the website. Is there another step I need to do?

    Also, how do you drop existing tables manually?
    Last edited by gws76; 12 Feb 2013 at 04:12 AM. Reason: additional info

  4. #4
    Join Date
    Apr 2007
    Posts
    151
    Plugin Contributions
    0

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    Sorry for the bump but when I open up the file that was saved today it's considerably smaller 116 kb and the file saved on earlier on the 4th is 4.28 mb and I can see looking through code see orders and product information in the older file save on the 4th. So I need to know how to drop all the existing tables manually to resolve this problem?

    PHP Code:
    Error

    SQL query
    :

    -- -- 
    Dumping data for table `address_book` -- INSERT INTO `address_book` (`address_book_id`, `customers_id`, `entry_gender`, `entry_company`, `entry_firstname`, `entry_lastname`, `entry_street_address`, `entry_suburb`, `entry_postcode`, `entry_city`, `entry_state`, `entry_country_id`, `entry_zone_id`) VALUES (11'm'NULL'***''***'', '***'''''***'', '***''''22312), (22'f'NULL'***'', '***'''***'', '', '***'''***'', '', 223, 12), (3, 3, 'm', NULL, '***'''***'', '***'''''***''***'''13183), (44'f'NULL'***''***''***''''***''***'''22362), (55'm'NULL'***''***''***''''***''***'''22318), (66'f'NULL'***''***''***''''***''***'''2234), (74'f'NULL'***''***''***''''***''***,'[...]

    MySQL saidDocumentation
    #1062 - Duplicate entry '1' for key 'PRIMARY' 

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    Quote Originally Posted by gws76 View Post
    Also, how do you drop existing tables manually?
    If you are SURE that you know what you're doing, then use phpMyAdmin to mark which tables you wish to DROP and choose DROP from the menu.

    But ... honestly, if you're asking that question, then you probably shouldn't be messing with phpMyAdmin. At least not if you don't have numerous confirmed-as-reliable backups.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Apr 2007
    Posts
    151
    Plugin Contributions
    0

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    After receiving errors trying to upload database to existing database I decided to create a new database for which I was able to upload my database contents from the 4th to the server and can now see product on the main page. I'm now in the process of trying to upgrade the database and get the following errors.

    database upgrade errors listed at the top of page above Zen Cart installer

    PHP Code:
    69 statements processed.
    Note1 statements ignoredSee "upgrade_exceptions" table for additional details.
    32 statements processed.
    62 statements processed.
    Note4 statements ignoredSee "upgrade_exceptions" table for additional details.
    13 statements processed 
    PHP Code:
    ATTENTION:  Problems Found
    NOTE
    Skipped upgrade statements5
    See details at bottom of page 
    for your inspection.
    (
    Details also logged in the "upgrade_exceptions" table.)
    NoteIn most casesthese failed statements can be ignored
    as 
    they are indications that certain settings may have already been set on your site
    If 
    all the suggested upgrade steps have been completed (no recommendations left), 
    you may proceed to Skip Upgrades and continue configuring your site 
    At the bottom of the page

    PHP Code:
    SKIPPEDCannot ALTER or INSERT/REPLACE into table linkpoint_api because it does not existCHECK PREFIXES!
    SKIPPEDCannot drop index page_accessed on table admin_activity_log because it does not exist.
    SKIPPEDCannot drop index access_date on table admin_activity_log because it does not exist.
    SKIPPEDCannot add index idx_page_accessed_zen to table admin_activity_log because it already exists.
    SKIPPEDCannot add index idx_access_date_zen to table admin_activity_log because it already exists

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: 1062 - Duplicate entry '1' for key 'PRIMARY' after importing old database

    Quote Originally Posted by gws76 View Post
    PHP Code:
    SKIPPEDCannot ALTER or INSERT/REPLACE into table linkpoint_api because it does not existCHECK PREFIXES!
    SKIPPEDCannot drop index page_accessed on table admin_activity_log because it does not exist.
    SKIPPEDCannot drop index access_date on table admin_activity_log because it does not exist.
    SKIPPEDCannot add index idx_page_accessed_zen to table admin_activity_log because it already exists.
    SKIPPEDCannot add index idx_access_date_zen to table admin_activity_log because it already exists
    The first one is because you've apparently not got the Linkpoint payment module activated ... which is unsurprising unless you're actually using them for credit card processing.
    The other 4 are a result of your database not needing the cleanup that those statements are intended to do.
    All 5 can be safely ignored.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v139a 1062 Duplicate entry '261228-7443 'for key' PRIMARY '
    By crb_style in forum General Questions
    Replies: 3
    Last Post: 6 Jun 2013, 02:06 PM
  2. 1062 Duplicate entry '31' for key 'PRIMARY'
    By yisou in forum General Questions
    Replies: 1
    Last Post: 8 Apr 2012, 05:18 PM
  3. 1062 Duplicate entry '5754' for key 'PRIMARY'
    By Pike Promo in forum General Questions
    Replies: 5
    Last Post: 17 Nov 2011, 04:52 AM
  4. Error when importing DB - #1062 - Duplicate entry '1' for key 'PRIMARY'
    By CheapStairParts in forum General Questions
    Replies: 0
    Last Post: 5 Jan 2011, 03:10 AM
  5. SQL Errors when importing to new database - #1062 - Duplicate entry '3' for key 1
    By countingsheep in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 17 Sep 2009, 09:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR