MySQL更换密码

一. MySQL8

1. 停止MySQL

net stop mysql

2. 进入免密码模式

mysqld --console --skip-grant-tables --shared-memory

3. 启动新窗口

mysql -uroot -p

4. 修改密码

use mysql
update user set authentication_string=’’ where user=‘root’ 如果这个字段有值,先置为空
flush privileges 刷新权限表
ALTER user ‘root’@‘localhost’ IDENTIFIED BY ‘密码’ 修改root 密码

 

posted @ 2021-05-01 22:58  yyfgrd  阅读(51)  评论(0编辑  收藏  举报