mysqlmysql-5.0mysql-5.1

MySQL 5.1 database export fails while importing into MySQL 5.1


I am having a particularly weird problem putting the data into my production server. My test server runs MySQL 5.1.41. I export the database (tried both via mysqldump and PHPMyAdmin) and then try to import into my production server that runs MySQL 5.0.92.

In one of the tables, I get an error "#1062 - Duplicate entry '1' for key 1". That table has a PRIMARY key and a UNIQUE composite key. When I look into output of phpmyadmin error, I do not see any duplicates.

I already tried: - exporting with the option "add AUTO INCREMENT" - checking whether the collations are the same. They are. Besides, the keys in question are numerics.

So if anybody knows what could be causing the error, and how to fix it - I would appreciate it.


Solution

  • The the solution was to remove the AUTO_INCREMENT attribute from columns before importing. Still do not understand why, though. The indexes could actually stay. Then the AUTO_INCREMENT could be easily added back. A mixture of what Martin & Silver Light proposed, but I guess none of the answers were exactly right.