Mysql Duplicate key problem in users table


When I looked at the user table to see if I could fix the issue this came up:

“Failed to save field : SQL alter table user add primary key (User) failed : Duplicate entry ‘root’ for key ‘PRIMARY’”

The original thing that came up was when restoring databases or adding databases to an account:

Creating MySQL database test_test …
Failed to create database : SQL insert into db (host, db, user, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Execute_priv, Event_priv, Trigger_priv) values (‘localhost’, ‘test_test’, ‘test’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’) failed : Duplicate entry ‘test’ for key ‘User’