Duplicate entry '%-root' for key 'PRIMARY'
select user,host from user; 查看是否已经有 host为’%'的root用户 #刷新mysql flush privileges; #删除掉host为localhost的用户 delete from user where user = ‘root’ and host = ‘localhost’; #再次刷新,重启mysql即可 flush privileges;