I'm new to PHP!

I'm trying to import an SQL file using phpMyAdmin through a GoDaddy cPanel(please don't make fun of me)

Here's a full readout

-- -- Dumping data for table `wp_commentmeta` -- INSERT INTO `wp_commentmeta` (`meta_id`, `comment_id`, `meta_key`, `meta_value`) VALUES (1, 3, 'rating', '5'), (37, 39, 'rating', '5'), (35, 37, 'is_customer_note', '0'), (4, 6, 'is_customer_note', '0'), (5, 7, 'is_customer_note', '0'), (6, 8, 'is_customer_note', '0'), (7, 9, 'is_customer_note', '0'), (8, 10, 'is_customer_note', '0'), (9, 11, 'is_customer_note', '0'), (10, 12, 'is_customer_note', '0'), (11, 13, 'is_customer_note', '0'), (34, 36, 'is_customer_note', '0'), (13, 15, 'is_customer_note', '0'), (14, 16, 'is_customer_note', '0'), (15, 17, 'is_customer_note', '0'), (16, 18, 'is_customer_note', '0'), (17, 19, 'is_customer_note', '0'), (18, 20, 'is_customer_note', '0'), (19, 21, 'is_customer_note', '0'), (45, 44, 'rating', '4'), (46, 45, 'rating', '4'), (22, 24, 'is_customer_note', '0'), (23, 25, 'is_customer_note', '0'), (24, 26, 'is_customer_note', '0'), (25, 27, 'is_customer_note', '0'), (26, 28, 'is_customer_note', '0'), (2[...]

I'm pretty inexperienced in PHP and I'm probably going to need this broken down like I'm a little baby, just a precaution


From what I can see, you are inserting data in table wp_commentmeta. However the column meta_id has a Primary Key restriction. You can see the table definition at http://codex.wordpress.org/Database_Description#Table:_wp_commentmeta

As meta_id has a Primary Key restriction, this column may only hold unique values. The insert statements you have posted show only unique values for meta_id, therefore my guess is that your current wp_commentmeta table already holds data. Value '1' is already in table and therefore you cannot insert '1' again.

  • Scratch my last comment... Again, I don't know too much about PHP, but could I alter the CREATE TABLE IF NOT EXISTS part of the table structure so that it... doesn't try to insert any details if they already exist(they do)? May 16 '14 at 18:24
  • You need to let us know what you are trying to achieve. We need more background information. Why are importing this SQL file?
    – AlexanderR
    May 16 '14 at 18:48
  • I'm migrating a Wordpress, this is the database.. I asked another, more helpful question that might be of some help. May 16 '14 at 19:00
  • That looks like the same question. I think you are going about this in the wrong way. You shouldn't have any database tables on the new server. You shouldn't have any files or even a WordPress installation. Starting from a empty folder where you want WordPress to run from, you copy the files (this creates WordPress). Then you use phpMyAdmin to import data to an empty database that you create for WordPress to use. Follow the instructions at this Tutsplus tutorial
    – AlexanderR
    May 16 '14 at 19:44

This is an old problem I had forgotten about. The problem here is that an old database was selected in the left hand menu of phpMyAdmin(read: I'm new to database management). The table was already in use and therefore populated - this error message is because phpMyAdmin tried to write to the first line, couldn't(already held data) and then quit.

Simply creating a new database and selecting it not only fixed this, but was the correct way to do exactly what I wanted. For some reason, all these answers are assuming that I'm not just simply inexperienced at SQL management; I'll take it as a compliment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.