mysql 5.7.10重置root密码:


1.my.nin文件里在 [mysqld]下增加“skip-grant-tables”
2.cmd:net start mysql
->mysql
->use mysql;
->UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
->FLUSH PRIVILEGES;
->quit;
3.登陆时,将my.min文件里的“skip-grant-tables”删除
登陆mysql -u用户 -p密码;

如果登陆进去报错1820,
登陆mysql -u -p 进去:输入mysql> SET PASSWORD = PASSWORD('123456');

 

创建用户:
create user hzx;
update user set authentication_string=password("123456") where user="hzx";
grant all on hzx.* to 'hzx'@'localhost';

create user text;
update user set authentication_string=password("123456") where user="text";
grant all on text.* to 'text'@'localhost';

3.刷新数据库 (一定要记得刷新)
mysql>flush privileges;
quit
mysql -uhzx -p
123456
成功!