[mysql]You must reset your password using ALTER USER statement before executing this statement.
原因分析:
MySQL版本5.6.6版本起,添加了password_expired功能,它允许设置用户的过期时间。这个特性已经添加到mysql.user数据表,但是它的默认值是”N”,可以使用ALTER USER语句来修改这个值。
MySQL 5.7.4版开始,用户的密码过期时间这个特性得以改进,可以通过一个全局变量default_password_lifetime来设置密码过期的策略,此全局变量可以设置一个全局的自动密码过期策略。可以在MySQL的my.cnf配置文件中设置一个默认值,这会使得所有MySQL用户的密码过期时间都为120天,MySQL会从启动时开始计算时间。my.cnf配置如下:
show variables like 'default_password_lifetime';

如果要设置密码永不过期,需要把default_password_lifetime修改为 0:
set global default_password_lifetime = ;

如果要为每个具体的用户账户设置单独的特定值,可以使用以下命令完成(注意:此命令会覆盖全局策略),单位是“天”,命令如下:
ALTER USER ‘xiaoming’@‘localhost' PASSWORD EXPIRE INTERVAL 250 DAY;
如果让用户恢复默认策略,命令如下:
ALTER USER 'xiaoming'@'localhost' PASSWORD EXPIRE DEFAULT;
个别使用者为了后期麻烦,会将密码过期功能禁用,命令如下:
ALTER USER 'testuser'@'localhost' PASSWORD EXPIRE NEVER;
修改密码命令:
alter user user() identified by "";
通过修改用户密码也可使当前用户可以成功执行权限内的命令。
[mysql]You must reset your password using ALTER USER statement before executing this statement.的更多相关文章
- 【mysql】must reset your password using ALTER USER statement before executing this statement
问题描述: must reset your password using ALTER USER statement before executing this statement 登录centos服务 ...
- 第一次登录mysql,使用任何命令都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
问题: 使用临时密码登录成功后,使用任何myql命令,例如show databases;都提示下面的报错 ERROR 1820 (HY000): You must reset your passwor ...
- MySQL用户密码过期登陆报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
今天接到主从复制失败告警,查看MySQL,发现MySQL能够登陆但是执行命令报错, ERROR 1820 (HY000): You must reset your password using ALT ...
- MySQL root账户密码设为“root”后执行命令提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
修改root账户密码为“root”后,提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement bef ...
- MySQL:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决方法: 修改密码:alter user 'root'@'localhost' identified by '123456'; mysql> use mysql; ERROR 1820 (HY ...
- 【mysql】You must reset your password using ALTER USER statement before executing this statement. 报错处理
1.问题:登陆mysql以后,不管运行任何命令,总是提示这个 mysql> select user,authentication from mysql.user; ERROR 1820 (HY0 ...
- mysql数据库问题———登录进去无法操作显示You must reset your password using ALTER USER statement before executing this statement
linux操作mysql数据库,可以登陆进去,但是操作所有命令都显示You must reset your password using ALTER USER statement before exe ...
- mysql报错:You must reset your password using ALTER USER statement before executing this statement.
新安装mysql后,登录后,执行任何命令都会报错: You must reset your password using ALTER USER statement before executing t ...
- MySQL数据库使用报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
今天MySQL数据库,在使用的过程中一直报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement be ...
随机推荐
- 9、Flutter 实现 生成二维码
1.加入依赖 在 pubspec.yaml 中 dependencies 节点下添加: dependencies: qr_flutter: ^ 2.引入代码 在需要细线二维码的 dart 类中引入依赖 ...
- [Android]使用Spring for Android改善数据交互流程
如果开发一个和服务端有数据交互android应用,流程通常是这样的:界面收集用户数据之后,将它转换成JSON或者XML格式的字符串,以HTTP的方式提交给服务端,获得返回的文本数据,再将数据解析为ja ...
- ngnix 反向代理来解决前端跨域问题
1.定义 跨域是指a页面想获取b页面资源,如果a.b页面的协议.域名.端口.子域名不同,所进行的访问行动都是跨域的,而浏览器为了安全问题一般都限制了跨域访问,也就是不允许跨域请求资源.注意:跨域限制访 ...
- JDK8 Stream操作整理
1,forEach this.quoteItemList.forEach(p -> p.setMode(mode)); 2,获取对话属性,去重后生成集合 List<String> p ...
- CarbonData-2:core
package Core是carbondata的核心代码. 照例,先看Test类.CarbonPropertiesValidationTest
- cycle标签和random两种方式美化表格
一:cycle标签实现给表格变色 1. <style>标签里写好需要的颜色 2. 在要变色的地方(行/列)加固定的语句,按照顺序依次执行 代码: <!DOCTYPE html> ...
- Unity XLua之协程
如何使用xlua实现协程,示例代码如下: 转载请注明出处:https://www.cnblogs.com/jietian331/p/10735773.html local unpack = unpac ...
- 【JavaScript】常用的数据类型的处理方式
写这篇文章的目的,是在学习过程中反复查找如何对这三种数据类型进行转换的方法,所以干脆总结在一起. 一.字符串 0.includes:string.includes(),查找当前string中是否包含某 ...
- go basic
go time and rand: package main import ( "fmt" "math/rand" "time" ) fun ...
- ASP.Net Core "The type initializer for 'Gdip' threw an exception"
ASP.NET Core项目部署在Linux下可能会出现GDI错误 The type initializer for 'Gdip' threw an exception 解决方案:创建 libdl 的 ...