登录mysql系统修改, mysql -uroot -p 回车 Enter password: 【输入原来的密码】
mysql>use mysql;
mysql> update user set password=password("新密码") where user='root';
mysql> flush privileges;
mysql> exit;
MySQL5.7版本后,password这个字段需改成 authentication_string,即:
mysql>use mysql;
mysql> update user set authentication_string=password("新密码") where user='root';
mysql> flush privileges;
mysql> exit;