Article ID: 116432, created on Jul 12, 2013, last review on Jun 22, 2015

  • Applies to:
  • Plesk 12.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 10.3 for Linux/Unix


If there is Plesk with MySQL 5.0 version, and there are databases with some unicode characters, migration or backup restore to Plesk server, where MySQL 5.1 version is used, may fail with error like:

ERROR 1062 (23000): Duplicate entry 'ц÷' for key 'PRIMARY'


Root cause is a bug in MySQL 5.0, which leads to wrong processing of collation utf8_general_ci. The bug is fixed in MySQL 5.1:


  1. Create backup of databases with mysqldump utility on the source server.

  2. Change collation for databases and tables from utf8_general_ci to utf8_bin on the source server:

    2.1. Getting collation of database:

    mysql> SHOW VARIABLES LIKE 'collation_database';

    2.2. Changing collation to utf8_bin for database:

    mysql> ALTER DATABASE db_name COLLATE utf8_bin;

    2.3. Getting list of tables with utf8_general_ci collation:

    mysql> SHOW TABLE STATUS WHERE Collation='utf8_general_ci';

    2.4. Changing collation to utf8_bin for table:

    mysql> ALTER TABLE tbl_name COLLATE 'utf8_bin';

    2.5. Getting columns with utf8_general_ci collation (performed for each table regardless of the collation):

    mysql> SHOW TABLES;
    (for each table): mysql> SHOW FULL COLUMNS IN tbl_name WHERE Collation='utf8_general_ci';

    2.6. Changing collation to utf8_bin for columns:

    mysql> ALTER TABLE tbl_name MODIFY column_name <column_specification> COLLATE 'utf8_bin';

    can be taken from:

    mysql> SHOW CREATE TABLE tbl_name;
  3. Perform migration.

  4. Return the collation back to utf8_general_ci on the source server.

  5. Change the collation from utf8_bin to utf8_general_mysql500_ci on the destination server.

Search Words

MySQL query failed: Duplicate entry '69478' for key 'PRIMARY'

01bc4c8cf5b7f01f815a7ada004154a2 56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 0a53c5a9ca65a74d37ef5c5eaeb55d7f 2a5151f57629129e26ff206d171fbb5f e335d9adf7edffca6a8af8039031a4c7 f4ce8084cb23619ef5fe9428ecc388ea dd0611b6086474193d9bf78e2b293040

Email subscription for changes to this article
Save as PDF