本地 MySQL 忘记 root 密码怎么救
步骤
- 管理员 CMD 停服务:
net stop MySQL80 - 跳过授权表启动:
mysqld --console --skip-grant-tables --shared-memory - 另开窗口无密码登录:
mysql -u root - 改密:
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
MySQL 8 必须带
--shared-memory才能本地无密码连上。
net stop MySQL80mysqld --console --skip-grant-tables --shared-memorymysql -u rootALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';MySQL 8 必须带
--shared-memory才能本地无密码连上。