MySql Server installation fails when your host name is localhost you will get the “ERROR: 1062 Duplicate entry ‘localhost-root’ for key 1” or “ERROR: 1062 Duplicate entry ‘localhost-‘ for key 1”
Simple solution is
Use the command hostname to give your system a host name and also change host name in the configuration file /etc/sysconfig/network
Source link