直接进入mysql:
#mysql - u root
mysql>;use mysql;
mysql>;update user set Password=PASSWORD('yourpass') where User = 'root';
mysql>;flush privileges;
mysql>;quit;
例如update user set password = password ('123456') where user = "root"
#mysql - u root
mysql>;use mysql;
mysql>;update user set Password=PASSWORD('yourpass') where User = 'root';
mysql>;flush privileges;
mysql>;quit;
例如update user set password = password ('123456') where user = "root"