MySQL8.0版本以上密码重置方法
2021/7/18 19:41:19
本文主要是介绍MySQL8.0版本以上密码重置方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
MySQL8.0的密码重置,以及提示“You must reset your password using ALTER USER statement before executing this statement.” 的解决方法。
一、密码重置
1.停止MySQL服务
C:\> net stop mysql
2.设置MySQL跳过权限表认证启动
C:\> mysqld --console --skip-grant-tables --shared-memory
3.重新打开一个命令提示符窗口,直接执行mysql
C:\> mysql
4.使用mysql表格
mysql> use mysql;
5.把密码设为空
C:\> update user set authentication_string = ' ' where user='root' ;
6.quit/exit 退出,关闭开的“跳过权限认证启动”服务,ctrl+c或者直接关闭窗口都可,再打开MySQL服务
mysql> quit Bye C:\> net start mysql
7.最好就再打开一个新的窗口(现在前面的窗口都可以关掉了),输入 mysql -uroot -p
后按enter(回车),再按一次回车(应为前面已经把密码设为空了)
C:\> mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.25 MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
二、修改密码
mysql> alter user user() identified by "需要修改的密码";
输入后提示
Query OK, 0 rows affected (0.01 sec)
就修改成功了
这篇关于MySQL8.0版本以上密码重置方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享
- 2024-02-22docker mysql 5.7
- 2024-02-18从 20 多套 MySQL 到 1 套 TiDB丨骏伯网络综合运营管理平台应用实践
- 2024-02-07mysql 外键索引入门介绍,为什么工作中很少有人使用?