for windows:
http://blog.chinaunix.net/uid-27570589-id-3511820.html
一、将net stop mysql;
二、在命令行中
C:\Users\nianxl>mysqld --defaults-file="D:\opensources\mysql-5.7.10-winx64\my.in
i" --console --skip-grant-tables
三、重新打开新窗口
mysql -u root -p 在提示输入密码时,直接回车
1.如果mysql 5.7的话
update
mysql.
user
set
authentication_string=
password
(
'123qwe'
)
where
user
=
'root'
and
Host =
'localhost'
;
2. update
mysql.
user
set
password=
password
(
'123qwe'
)
where
user
=
'root'
and
Host =
'localhost'
;
3. flush privileges;
4.exit
for linux:
http://www.th7.cn/system/win/201512/146953.shtml