MyBB Community Forums

Full Version: [F] phpBB3: SQL error 1062 during users import
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A user reported that he gets the following error converting from phpBB3. He said he had no problems with beta3 but with beta5 it isn't working.
SQL Error:
    1062 - Duplicate entry 'K' for key 2
Query:
    INSERT INTO mybb_users (`usergroup`,`additionalgroups`,`displaygroup`,`import_usergroup`,`import_additi​onalgroups`,`import_displaygroup`,`import_uid`,`username`,`password`,`salt`,`log​inkey`,`email`,`regdate`,`lastactive`,`lastvisit`,`website`,`showsigs`,`signatur​e`,`showavatars`,`timezone`,`avatardimensions`,`avatartype`,`avatar`,`lastpost`,​`icq`,`aim`,`yahoo`,`msn`,`hideemail`,`allownotices`,`regip`,`lastip`,`longregip​`,`longlastip`,`language`,`passwordconvert`,`passwordconverttype`,`postnum`,`inv​isible`,`birthday`,`birthdayprivacy`,`subscriptionmethod`,`receivepms`,`pmnotice​`,`pmnotify`,`remember`,`showquickreply`,`ppp`,`tpp`,`daysprune`,`timeformat`,`d​st`,`buddylist`,`ignorelist`,`style`,`away`,`awaydate`,`returndate`,`referrer`,`​reputation`,`timeonline`,`showcodebuttons`,`totalpms`,`unreadpms`,`pmfolders`,`n​otepad`,`threadmode`,`showredirect`,`dateformat`,`dstcorrection`,`warningpoints`​,`moderateposts`,`moderationtime`,`suspendposting`,`suspensiontime`,`coppauser`,​`classicpostbit`,`loginattempts`,`failedlogin`) VALUES ('2','','2','2','','2','635','K�bler','','irgendeincode','irgendeincode','email@​example.com','Nummer','Nummer','GleicheNummerWieDavor','','1','','1','10','0|0','','','0​','','','','','1','0','***IP-Adresse***','','0','0','','***Code***','phpbb3','0','1','','all','0','1','1','1'​,'1','1','0','0','0','D j. M Y, H:i','1','','','0','0','0','0','0','0','0','1','0','0','1**Inbox$%%$2**Sent Items$%%$3**Drafts$%%$4**Trash Can','','','1','0','1','0','0','0','0','0','0','0','0','0')
Me and Josh actually got this on Beta 3 IIRC. It's doesn't seem to happen every time though, it's odd, sometimes it works fine, sometimes it gives this error.
Please provide repro. instructions. There is no clear reason why this is happening as we already have a separate duplicate users handling code
I'm the user who get this error.

The error comes, when I convert the users, but only with users, who have German umlauts like ä, ö or ü in their username.

The database encoding is UTF-8 Unicode.

pcworld
That makes more sense - Though it is still odd that MySQL isn't matching those strings properly
Is it possible that this bug can be fixed? Wink

pcworld
So, now it is working.
The database must have the correct encoding... Smile

But there was one bug, too: Then I it was possible to convert the phpBB3. But if there was a German umlaut like ä, ö or ü in a forum description or in a post, the post was be cutted at the place, where normally the umlaut stands.
So that is the answer to this problem:
Before converting, replace in inc/config.php this:
$config['database']['encoding'] = 'utf8';
with this:
$config['database']['encoding'] = '';
And after the converting do it backwards. Smile

Sorry for my bad English Wink
German users can read the answer to the problem here: http://forum.mybboard.de/thread-13566-post-97010.html

pcworld
I think I fixed it - It looks like the LOWER() function in MySQL isn't UTF-8 safe or has some sort of bug.
This bug has been fixed in the latest version of the MyBB Merge System.

Please note the latest code is not live on the site or for download. An update for the MyBB Merge System will be released which contains this fix.

With regards,
The MyBB Group