[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 ...
随机推荐
- jQuery动画方法
下面介绍一些使用jQuery实现动画的方法: html中有如下代码: <button id="btn-box1">show</button> <but ...
- github仓库的初步使用
github是被戏称为男人们的朋友圈,在github里可以很方便的和同伴合作.以下是github初步建立的步骤.(由于我已经安装好了,所有没有插入图片,如果有未降到的问题先自行百度,如果我后续碰到有关 ...
- Fiddler抓包【7】_次要功能和第三方插件
1.替换HTTP Request Host 应用场景:进行开发时,线上去测试跳转调试 替换命令:urlreplace news.baidu.com www.baidu.com: 清除命令:urlrep ...
- python实现使用词云展示图片
记录瞬间 首先,要安装一些第三方包 pip install scipyCollecting scipy Downloading https://files.pythonhosted.org/packa ...
- linux目录详细列表
详细列表 目录 说明 备注 bin 存放普通用户可执行的指令 即使在单用户模式下也能够执行处理 boot 开机引导目录 包括Linux内核文件与开机所需要的文件 dev 设备目录 所有的硬件设备及周边 ...
- 对java多态的理解
java多态,如何理解父类引用指向子类对象 要理解多态性,首先要知道什么是“向上转型”. 我定义了一个子类Cat,它继承了Animal类,那么后者就是前者是父类.我可以通过 Cat c = new C ...
- mysql 查询前几条数据
limit是mysql的语法select * from table limit m,n其中m是指记录开始的index,从0开始,表示第一条记录n是指从第m+1条开始,取n条.select * from ...
- liunx驱动----构造和运行模块
以hello world模块为例 #include <linux/init.h> #include <linux/module.h> //在执行 insmod hlello 的 ...
- DotNetCore 部署到IIS 上
将 DotNetCore MVC 项目成功部署到 IIS 上,记录下配置要点: 1.在 ASP.NET Core 应用中使用 Kestrel Microsoft.AspNetCore.App 元包中包 ...
- 什么是Referer?Referer的作用?空Referer是怎么回事?
什么是Referer? Referer是 HTTP请求header 的一部分,当浏览器(或者模拟浏览器行为)向web 服务器发送请求的时候,头信息里有包含 Referer.比如我在www.sojson ...