1.登陆
mysql -uroot -p
2.查看账户以及允许的主机号
use mysql;
select host,user from user;
3.重新设置权限
grant privileges on *.* root @'%' identitied by "root";
或者直接对表进行修改
update user set host='%' where user='root';
或者只对特定ip开放
GRANT ALL PRIVILEGES ON . TO ‘root’@‘10.10.11.12’ IDENTIFIED BY ‘root’ WITH GRANT OPTION;
4.刷新权限
flush privileges;
注:修改密码
update user set password=password('123') where user='root';