1.进入mysql的bin目录下
mysqld --initialize --console;
2.安装mysql服务
mysqld install;
3.启动mysql服务
net start mysql;
4.登录
mysql -u root -p;
5.输入密码
执行命令:mysqld --initialize --console
(在(mysqld --initialize --console)命令生成的日志里面)
6.选中数据库
use mysql;
7.修改密码
alter user 'root'@'localhost' identified by 'root' password expire never;
8.修改验证规则
alter user 'root'@'%' identified with mysql_native_password by 'root';
9.修改root用户权限
update user set host='%' where user='root';
10.刷新权限
flush privileges;