windows系统下的mysql 8.0 修改密码、创建用户

https://blog.csdn.net/qq_40015409/article/details/111583235
1.以管理员权限运行cmd


2.停止服务
net stop mysql // 不需要关闭服务


3.cd mysql安装目录


4.mysqld --console --skip-grant-tables --shared-memory


5.新开一个以管理员权限运行cmd


6.flush privileges;
参考:
https://zhuanlan.zhihu.com/p/63634699


7.use mysql;


8.select host,user,plugin,authentication_string from user;
或 show variables like 'default_authentication_plugin';


9.alter user 'root'@'localhost' identified with mysql_native_password by '123456'; //此时密码仍是加密的的密码
update user set authentication_string='123456' where user=root'; //此时密码为123456
// MySQL8下忘密码后重置密码的办法

 

10.创建远程登录用户
create user 'remote'@'%' identified by '123456';


11.修改用户密码为本地密码
alter user 'remote'@'%' identified mysql_native_password by '123456';


12.update user set authentication_string='123456' where user=remote'; //不能用此sql语句更改密码为123456

 

13. https://cloud.tencent.com/developer/ask/130030 password_expired='N'
参考:https://www.iteye.com/blog/venus224-998476

 

14.grant all privileges on *.* to 'root'@'localhost' identified by '123456';
参考:
https://jingyan.baidu.com/article/f7ff0bfcb914916e26bb13ac.html
https://www.iteye.com/blog/venus224-998476

posted @ 2023-01-10 10:01  明月忧忧  阅读(447)  评论(0)    收藏  举报