Before the server data loss decided to move out with phpmyadmin export, because the database file is relatively large, so directly using the MySQL command direct import
MySQL Export Import command
But the results are always there.
ERROR 1062 (23000) at line 1262:duplicate entry '. ꡣh o ' for key 2
And then it stops. Nnd this guy eats soft and doesn't eat hard. Come on, hard. --force. Forced import. Do not exit
# mysql-u Root-p Fukai--force < Dmc010003_db.myisam.sql
Enter Password:
ERROR 1062 (23000) at line 1262:duplicate entry '. ꡣh o ' for key 2
ERROR 1062 (23000) at line 1263:duplicate entry ' m?oʙh m ' for key 2
ERROR 1062 (23000) at line 1271:duplicate entry '? ^ц ' for key 2
ERROR 1062 (23000) at line 5182:duplicate entry '. ꡣh o ' for key 2
ERROR 1062 (23000) at line 5187:duplicate entry '? ^ц ' for key 2
ERROR 1231 (42000) at line 7268:variable ' Sql_mode ' can ' t being set to the value of ' NULL '
yingouqlj@qljlearnhost:/home/jump$ MySQL uynetwork <z.sql-u root-p
Enter Password:
ERROR 1062 (23000) at line 20449:duplicate entry '?????? ' for key 1 puzzle
After the Internet access to say that use-force Force import
MySQL uynetwork <a.sql-force-u root-p then a large error occurred
But there's still a problem.
Finally found that the original in the phpMyAdmin exported file encoding is the last use of UTF-8
The code is as follows |
Copy Code |
MySQL uynetwork <p.sql-u root-p--default-character-set=utf8 |
Summarize
Duplicate entry...for Key ... The cause of the error is a duplicate of the primary key's unique value. When a database is modified, inserted, and the unique value of a primary key is repeated, this error is reported, sometimes when multiple primary keys exist in the table, the table operation is still reported as a result of the index of the table. For example, a table has id1,id2 two primary keys, however, when inserting data, there is already a record of ff,11, insert ff,22 Such a record should be no problem, but reported the above error, the reason is that the index only id1 this field index, There is no federated index for ID2, so an error occurs when inserting the ff,22 record.
Processing method: Index_1 in the indexes of the table is processed, and adding another primary key is OK.