1.进入mysql数据库
mysql>update user set password=PASSWORD(‘123456’) where User='root';
2.执行语句
mysql -u root –p
use mysql;
update user set host = '%' where user = 'root';
select host, user from user;
3.授权。
例如,你想root使用密码123456从任何主机连接到mysql服务器。
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;