MAC OS,MYSQL 5.7
service mysqld stop(Mac上不管用,直接杀进程)
mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
use mysql;
update user set password=PASSWORD("newpass") where user="root";
// 5.7上应该是下面的,因为5.7中字段改了
update user set authentication_string=PASSWORD("123456") where user="root";
// 更改密码为 newpassord
flush privileges; 更新权限
quit 退出