Mysql5.7.13忘记密码及创建用户
mysql 5.7.13重置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.登陆
mysql 5.7.13重置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 yzkj; update user set authentication_string=password("123456") where user="yzkj"; grant all on hzx.* to 'yzkj'@'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 -uyzkj -p 123456 成功!