• A friend had a WordPress site that went literally months without any updates. Eventually a vulnerability was exploited and his site was shut down by the hosting service for spam. He kind of gave up on it. After the hosting service restored access, I got a database error trying to access WP admin. I figured the old version (no clue what the site was running three years ago) was just too outdated to work anymore

    So I installed the current version of WordPress at his domain and now I’m trying to restore the site from the old .sql file. I created a new .sql database and am trying to import from the old one. I keep getting errors that certain tables already exist, and the import does not finish. There is no .xml file from the old install to import via the dashboard.

    Any ideas?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator James Huff

    (@macmanx)

    Thread Starter DevonTT

    (@devontt)

    Yes, I did those steps and got an error, which led me here: “If you get an error message, your best bet is to post to the WordPress support forums to get help.”

    Thread Starter DevonTT

    (@devontt)

    Here is the error I got when trying to import the database:

    Error
    SQL query:


    — Database: michaelb_wpmb

    — ——————————————————–


    — Table structure for table wp_comments

    CREATE TABLE wp_comments (
    comment_ID bigint(20) UNSIGNED NOT NULL,
    comment_post_ID bigint(20) UNSIGNED NOT NULL DEFAULT ‘0’,
    comment_author tinytext COLLATE utf8mb4_unicode_ci NOT NULL,
    comment_author_email varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    comment_author_url varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    comment_author_IP varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ”,
    comment_date datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    comment_date_gmt datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    comment_content text COLLATE utf8mb4_unicode_ci NOT NULL,
    comment_karma int(11) NOT NULL DEFAULT ‘0’,
    comment_approved varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ‘1’,
    comment_agent varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFA[…]
    MySQL said: Documentation

    #1050 – Table ‘wp_comments’ already exists

    Moderator James Huff

    (@macmanx)

    That’s odd, did the table already exist before you started the import? Also, how did you generate the backup?

    Thread Starter DevonTT

    (@devontt)

    The table that existed is in the .sql file from when the site was active three years ago. I assume these are typical tables for even old WP installations.

    Thread Starter DevonTT

    (@devontt)

    Well, I just tried exporting the .sql database as an .xml file, then importing it into WP using the Import tool. I got this message:

    Sorry, there has been an error.
    This does not appear to be a WXR file, missing/invalid WXR version number

    Moderator James Huff

    (@macmanx)

    Right, changing the file extension does also change it into a WordPress export file. You can only generate that from within a WordPress site’s Dashboard.

    What I meant earlier was, do tables already exist in the database you’re importing this to?

    Thread Starter DevonTT

    (@devontt)

    Yes, the table I’m importing into is the database created by the new WP installation.

    Moderator James Huff

    (@macmanx)

    Ah! That’s the problem. πŸ™‚

    Since you’re importing a whole WordPress database, you don’t need the tables created by the existing new WordPress database.

    So (assuming this new installation is bare with no content), delete those newly created tables, and import your database.

    Thread Starter DevonTT

    (@devontt)

    So, delete all the tables in the new database?

    Moderator James Huff

    (@macmanx)

    Assuming this new installation is bare with no content, yes.

    Then import the new database.

    Thread Starter DevonTT

    (@devontt)

    OK, I’ll give that a try, thanks!

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Error importing from .sql database’ is closed to new replies.