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.

Importing database now gives SQL error

September 20, 2012 2:22pm

Subscribe [2]
  • #1 / Sep 20, 2012 2:22pm

    J. Hull

    132 posts

    Been doing this for awhile now (exporting from MAMP PRO using phpmyadmin, then importing the database to the staging server (enginehosting). Last night tried to do the same and it failed, giving me this error:

    Error
    
    SQL query:
    
    --
    -- Database: `dramee`
    --
    -- --------------------------------------------------------
    --
    -- Table structure for table `exp_accessories`
    --
    CREATE TABLE `exp_accessories` (
    `accessory_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `class` VARCHAR( 75 ) NOT NULL DEFAULT '',
    `member_groups` VARCHAR( 255 ) NOT NULL ,
    `controllers` TEXT,
    `accessory_version` VARCHAR( 12 ) NOT NULL ,
    PRIMARY KEY ( `accessory_id` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =5;
    
    MySQL said:
    #1050 - Table 'exp_accessories' already exists

    Any ideas what could be causing this? How can I fix it? And lastly, is there a better way to export/import databases between local and staging servers? Just want to make sure I’m engaging in best practices. Thanks!

  • #2 / Sep 20, 2012 2:26pm

    Stephen Callender

    148 posts

    Hello J. Hull.
    That sucks. Are you clearing out all the tables before importing the new db?

    edit: Oh, if you’re on a Mac, try Sequel Pro. Much better than phpMyAdmin

  • #3 / Sep 20, 2012 2:33pm

    J. Hull

    132 posts

    No, no clearing. I usually just click import, choose the file and Go. Is that wrong?

  • #4 / Sep 20, 2012 2:37pm

    Stephen Callender

    148 posts

    Your error is that the table “already exists.” If you first drop all the tables, then you should be fine. I always clear tables out when importing a new version of the db.

  • #5 / Sep 21, 2012 4:21pm

    J. Hull

    132 posts

    By clearing out you mean “dropping” right? I did that last night, dropped all the tables, then imported and it worked great. Thanks.

  • #6 / Sep 24, 2012 1:49am

    Kevin Smith

    4784 posts

    Thanks for the help here, Stephen.

    J. Hull, yes, he’s recommending (and I agree) that it’s a good idea to clear out your database before importing a fresh copy. Make sure there aren’t any tables left in the database immediately before the import. Glad to see that it worked well for you!

    Anything else you need help with?

  • #7 / Sep 24, 2012 12:43pm

    J. Hull

    132 posts

    Yeah, if you could somehow remind me to export the database before I drop it that would save me a couple hours of lost work! I ended up dropping the version I wanted to save this weekend…argh! I’ll be sure to double check from now on…Thanks again for the help here - excellent as always.

  • #8 / Sep 24, 2012 5:56pm

    Kevin Smith

    4784 posts

    Yikes, that’s not good! I’m glad we were able to help here, though. Let us know when we can help again!

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

ExpressionEngine News!

#eecms, #events, #releases