系统win10 mysql8
1. 进入 C:\Program Files\MySQL\MySQL Server 8.0 删除data文件夹
// 开一个管理员 powershell
2. cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
3. mysqld -remove MySQL
4. mysqld --initialize-insecure
5. mysqld --install
6. 关闭服务 net stop mysql
7. 运行 mysqld --console --skip-grant-tables --shared-memory
// 另开一个管理员 powershell
8. 无密码登录mysql mysql -uroot
9. 清空密码 update mysql.user set authentication_string='' where user='root' and host='localhost';
// 再另开一个管理员 powershell 关闭其他的powershell
10. 开启mysql服务 net start mysql
11. mysql -u root -p
12. 这时候会让你输入密码, 直接回车
13. 重新设置密码 alter user user() identified by '123456';
14. FLUSH PRIVILEGES;
15. quit
密码修改完毕.