sql database password reset mysql5.5 version (reset MYSQL user password under WINDOW)

1.打开 cmd ,进入到Mysql Server路径:
C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin

Insert picture description here
Insert picture description here

2.查找MySQL进程:
tasklist |findstr mysql
C:\Program Files\MySQL\MySQL Server 8.0\bin>tasklist |findstr mysql
mysqld.exe                    3268 Services                   0      2,028 K
C:\Program Files\MySQL\MySQL Server 8.0\bin>taskkill /F /PID 3268
成功: 已终止 PID 为 3268 的进程。

Enter mysql, suggesting ERROR 2003 (HY000): Can not connect to MySQL server on 'localhost' (10061)
Note that 第二步是为了关闭sql
the second step can also be replaced by the following

停止mysql服务:
net stop mysql
3.开启跳过密码验证登录的MySQL服务
mysqld --console --skip-grant-tables --shared-memory 
4.再打开一个新的cmd,进入bin目录,无密码登录MySQL
mysql -u root -p
5.设置新密码
>use mysql
>update user set Password=password('新密码') where User='root';
>flush privileges;
6.退出mysql
quit
7.关闭--console --skip-grant-tables --shared-memory 页面,启动MySQL服务。
net start mysql 
8.输入登录命令:mysql -u root -p
输入密码

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42540340/article/details/108283432