We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39501
    • 163 Posts
    Hi there,

    I'm trying to put my site live from my local dev environment.


    My setup:

    • MODX version: Rev 2.2.2-pl
    • PHP version: 5.3.0
    • MySQL version: 5.1.37
    • Apache via XAMPP v1.7.2a

    After closing all browser windows with my site in it, clearing cache, flushing permissions, flushing sessions, I go to export my database via phpmyadmin.

    When I go to import the database into my live environment via phpmyadmin I get the following error:

    SQL query:
    
    --
    -- Dumping data for table `modx_access_context`
    --
    INSERT INTO  `modx_access_context` (  `id` ,  `target` ,  `principal_class` ,  `principal` ,  `authority` ,  `policy` ) 
    VALUES ( 1,  'web',  'modUserGroup', 0, 9999, 3 ) , ( 2,  'mgr',  'modUserGroup', 1, 0, 2 ) , ( 3,  'web',  'modUserGroup', 1, 0, 2 ) , ( 4,  'mgr',  'modUserGroup', 1, 9999, 11 ) ;
    
    
    MySQL said: 
    
    #1062 - Duplicate entry '1' for key 1 


    I came across this in the forum:
    https://forums.modx.com/index.php?topic=31342.0

    But there was no actual solution to how he fixed the problem.


    Can anyone help?

      • 52683
      • 1 Posts
      Quote from: jonleverrier at May 10, 2012, 05:52 AM
      Hi there,

      I'm trying to put my site live from my local dev environment.


      My setup:

      • MODX version: Rev 2.2.2-pl
      • PHP version: 5.3.0
      • MySQL version: 5.1.37
      • Apache via XAMPP v1.7.2a

      After closing all browser windows with my site in it, clearing cache, flushing permissions, flushing sessions, I go to export my database via phpmyadmin.

      When I go to import the database into my live environment via phpmyadmin I get the following error:

      SQL query:
      
      --
      -- Dumping data for table `modx_access_context`
      --
      INSERT INTO  `modx_access_context` (  `id` ,  `target` ,  `principal_class` ,  `principal` ,  `authority` ,  `policy` ) 
      VALUES ( 1,  'web',  'modUserGroup', 0, 9999, 3 ) , ( 2,  'mgr',  'modUserGroup', 1, 0, 2 ) , ( 3,  'web',  'modUserGroup', 1, 0, 2 ) , ( 4,  'mgr',  'modUserGroup', 1, 9999, 11 ) ;
      
      
      MySQL said: 
      
      #1062 - Duplicate entry '1' for key 1 


      I came across this in the forum:
      https://forums.modx.com/index.php?topic=31342.0

      But there was no actual solution to how he fixed the problem.


      Can anyone help?

      Hey buddy, Im having the same issue. Did you manage to fix it?
        • 3749
        • 24,544 Posts
        The IDs of the stuff you're importing is colliding with the IDs of objects already in the DB.

        If you want to replace everything that's on the remote site with the stuff from the local site, you need to use the custom option when you export the data from the local DB, and select "Drop Table if Exists".

        That will drop each table on the remote and replace it with the table from the local site.

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting