• Hi all, trying to change the URL of my website which has an ugly address at the moment – 123907blah.netsolhost.com – by changing all occurrences of this in the database (exported via phpmyAdmin) to the official domain name that’s already mapped to it (but couldn’t connect to it via General Settings) then reimporting using phpmyAdmin again. The domain name works ok, I’ve checked it on absolute URLs to specific WP files.

    It should be simple enough to export and re-import, but whenever I’ve tried this before, there’s always some errors. So in this case, I get the error “#1062 – Duplicate entry ‘1’ for key 1” in the wp_commentmeta table. I’ve searched for this throughout the forums, and the usual answer seems to be – you have a duplicate entry somewhere.

    But my knowledge of databases is way short of what it should be – so what should I actually do in this case, to reimport the data? Can I simply delete the commentmeta table or fields, since (it seems to me) I don’t need the comments left on the website’s posts? Would that theoretically sort the problem, or would that mean problems in future if I decided I DID want more comment interactions?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Please, before you do any of this Backup your WordPress files and Database
    If you have some sort of CPanel type software, you should be able to “backup” the database and if you go to where your backups are stored, you can just download and extract then import the .sql file. Or, you could go to PhpMyAdmin and export the database as sql and at the bottom of the export page just check off “save as file” and download it as a file and re-upload it in the new site/server

    also, i think you can just export the posts and comments table, re-install wordpress and delete the ones that it makes by default and import your old tables(comments and posts) as i explained above

    You should empty or delete your existing tables before re-importing the database.

    Also, be careful when changing the blog URL in the database dumps, if you’re using a simple Search & Replace: In some places, the URL stored to the database is part of a “serialized” data structure, so just replacing it might break this data structure, if the length of your new URL doesn’t match the length of your old URL.

    Thread Starter mikem42

    (@mikem42)

    Thanks so much for your prompt response, guys. Alex & Anthony – I have backed the files up, that’s why I’m using phpMyAdmin to work with the backup files (and if all goes pear-shaped I can hopefully simply re-upload the original sql file).

    I was hoping to do all this without re-installing WP, seems pretty full-on for what should be a simple request? Here’s the actual problem area from the wp_commentmeta table:

    — Table structure for table wp_commentmeta

    CREATE TABLE IF NOT EXISTS wp_commentmeta (
    meta_id bigint(20) unsigned NOT NULL auto_increment,
    comment_id bigint(20) unsigned NOT NULL default ‘0’,
    meta_key varchar(255) default NULL,
    meta_value longtext,
    PRIMARY KEY (meta_id),
    KEY comment_id (comment_id),
    KEY meta_key (meta_key)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;


    — Dumping data for table wp_commentmeta

    INSERT INTO wp_commentmeta (meta_id, comment_id, meta_key, meta_value) VALUES
    (1, 75, ‘_wp_trash_meta_status’, ‘0’),
    (2, 72, ‘_wp_trash_meta_status’, ‘0’),
    (3, 69, ‘_wp_trash_meta_status’, ‘1’),
    (4, 85, ‘_wp_trash_meta_status’, ‘0’),
    (5, 85, ‘_wp_trash_meta_time’, ‘1292503251’),
    (6, 82, ‘_wp_trash_meta_status’, ‘0’),
    (7, 82, ‘_wp_trash_meta_time’, ‘1292503296’),
    (8, 81, ‘_wp_trash_meta_status’, ‘0’),
    (9, 81, ‘_wp_trash_meta_time’, ‘1292503304’);

    Can I simple delete these lines from the sql file, or do I delete particular values? Sorry if that sounds obvious, but without going on a db training course (which I DO need to do…) I’m hoping I can get away with following simple instructions!

    Thank you again…

    Thread Starter mikem42

    (@mikem42)

    OK, realised my error and hadn’t ticked the ‘Add Drop Table’ option on exporting. So I did all the above, changed the URLs (testing them to make sure the new absolute URLs linked to the right files or locations, and they did), reimported and despite a “success” message, I realised that looking in the wp_options table, the original ugly URLs were still there!

    Why would these values not have overwritten the old table values properly, despite them apparently dropping the old data? Is there an easy way of doing this, or do I need to start with a fresh db, something I’m pretty nervous about?

    Thanks.

    zendim

    (@zendim)

    Thanks for pointing this out on the “Add Drop Table” box being checked. There are a few “step by step” tutorials out there that don’t mention this, and it sticks a lot of people like us.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Stuck re-importing database’ is closed to new replies.