1.再 my.cnf 配置文件追加:
skip-grant-tables
skip-networking
2.重啟mysql 服務(wù) serive mysql restart
3.輸入mysql -uroot 進(jìn)入到命令行
4.使用命令行修改
update mysql.user set authentication_string=password('你的密碼');
5.繼續(xù)輸入:FLUSH PRIVILEGES谴轮;
6.使用exit; 退出施流。然后注釋掉my.cnf 中的
#skip-grant-tables
#skip-networking
7.重啟mysql服務(wù)