提供2个方法
grant授权root用户localhost权限,例如:
grant all privileges on * to root@localhost identified by 'password';
修改MySQL库user表将user=root的host修改为localhost
update user set host='localhost' where host='127.0.0.1' ;