方法1:
運行MySQL 5.7 Command Line Client,輸入老的密碼;
use mysql;
update user set authentication_string=password('test1234') where user='root';
方法2:
運行MySQL 5.7 Command Line Client,輸入老的密碼;
set password=password('newpassword');
方法3:
alter user root@'localhost' identified by 'test1234';
假如已經修改mysql下的user表root賬號下的host為%時,需要用下面的語句
alter user root@'%' identified by 'test1234';
方法4:進入mysql的bin目錄:
mysqladmin -uroot -poldpassword pasword "newpassword"
修改完密碼后,退出mysql,重啟mysql服務,密碼才能生效。