I am trying to import a (Wordpress) database, exported from a local XAMPP installation into a Google cloud SQL database.
I followed the steps from the Google documentation, so completed the following steps:
mysql_query Duplicate entry '1' for key 'PRIMARY' (INSERT INTO
`wp_comments` (`comment_ID`, `comment_post_ID`, `comment_author`,
`comment_author_email`, `comment_author_url`, `comment_author_IP`,
`comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`,
`comment_approved`, `comment_agent`, `comment_type`, `comment_parent`,
`user_id`) VALUES (1, 1, 'Mr WordPress', '', 'https://wordpress.org/', '',
'2015-07-11 09:58:54', '2015-07-11 09:58:54', 'Hi, this is a comment.\nTo
delete a comment, just log in and view the post's comments. There you will
have the option to edit or delete them.', 0, 'post-trashed', '', '', 0, 0))
You need to delete all tables (clear your database) and than import that .sql file. This error is occurring because you have already table of wp_comments and it contains an comment with that same ID.
Importing an SQL file, never replace data. It simply generate an error if duplicate record is going to happen as under primary key.