• Venkata Sidagam's avatar
    Bug #18415196 MYSQL_UPGRADE DUPLICATE KEY ERROR FOR MYSQL.USER FOR 5.5.35+, 5.6.15+, 5.7.3+ · 7879b3ee
    Venkata Sidagam authored
    Description: mysql_upgrade fails with below error, 
    when there are duplicate entries(like 'root'@'LOCALHOST'
    and 'root'@'localhost') in mysql.user table.
    ERROR 1062 (23000) at line 1140: Duplicate entry 'localhost-root' for key 'PRIMARY'
    FATAL ERROR: Upgrade failed
    
    Analysis: As part of the bug 12917151 fix we are 
    making all the hostnames as lower case hostnames.
    So, this has been done by mysql_upgrade.
    In case of above mentioned duplicate entries 
    mysql_upgrade tries to change hostname to lowercase.
    Since there is already 'root'@'localhost' exists.
    it is failing with "duplicate entry" error.
    
    Fix: Since its a valid error failure. We are 
    making the error more verbose. So, that user will
    delete the duplicate errors manually.
    Along with existing error we are printing below
    error as well.
    ERROR 1644 (45000) at line 1153: Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them
    7879b3ee
mysql_system_tables_fix.sql 30.2 KB