停止mysql服务,在my.ini中,mysqld 节下加入
skip-grant-tables
启动mysql服务
root登录mysql
mysql -u root
5.7
update mysql.user set authentication_string=password('123456') where user='root';
5.6 or before
update user set password=PASSWORD('123456') where user='root';
flush privileges;
exit;
停止mysql,去掉my.ini 中的 skip-grant-tables,在启动
Done!