PHPMyAdmin version 2.9.1.1
Back up data with phpMyAdminDatabaseAfter export, use it locallyPHPWhen restoring MyAdmin or sqlyog, the following error occurs:
Error occured at: 10:09:43
Line No.: 11154
Error code: 1062-duplicate entry '?????? 'For key 2
The reason is that the Chinese part of the file content is garbled and all are similar ???,???? Because there are manyProgramThe Chinese user names are supported, and the user names are unique. After the chinese user names become garbled, many identical user names appear, and we import these garbledDataThere are already ?????? This user name is used, so the second one is shown below and an error is reported.
IfSystemYou can use the following command to export data without garbled characters.
MySQLDump-uroot-p -- default-character-set = utf8 -- Set-charset -- skip-opt dbname> newdbname. SQL
But now can only use phpMyAdmin export, test for a long time, found that if phpMyAdmin language is "Chinese-Chinese simplified-gb2312", export the SQL file is gb2312, some tables have Chinese, chinese characters are garbled. When the Laguage of phpMyAdmin is "Chinese-Chinese Simplified(That is, utf8) ", the exported SQL file character set is utf8 (with notepad ++ to view the format, the display is UTF-8 without BOM format encoding ), the Chinese characters in the table can be displayed normally.
to prevent Chinese characters from being garbled in exported files, select Chinese-Chinese Simplified from the language drop-down menu, and then select export, the Chinese characters in the downloaded SQL file can be displayed normally.
use the following command to restore
mysql-uroot-p -- default-character-set = utf8 newdbname
I originally wanted to change the default language of phpMyAdmin to "Chinese-Chinese ". simplified ", however, I tried to modify config. inc. config. default. PHP are useless, it doesn't matter, after all, different people choose the database encoding are not the same, there is always someone to re-choose the language, or let it default is "Chinese-Chinese simplified-gb2312!
Another solution is to guess that the exported file code is gb2312, so you can consider converting gb2312 to utf8. this method is being tested.