[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 ...
随机推荐
- [SpringMVC]自定义注解实现控制器访问次数限制
我们需要根据IP去限制用户单位时间的访问次数,防止刷手机验证码,屏蔽注册机等,使用注解就非常灵活了 1 定义注解 @Retention(RetentionPolicy.RUNTIME) @Target ...
- winsock I/O模型的分析
几种winsock I/O模型的分析 套接字是通信的基础,是支持网络协议数据通信的基本接口.Winsocket 提供了一些有趣的I/O模型,有助于应用程序通过一种“异步”方式,一次对一个或者多个套接字 ...
- nodejs:导出Excel和解析导入的Excel
用的是koa2框架,但好好处理一下,用express框架也是可以的.导出的Excel是xlsx的格式,解析导入Excel的有xlsx和csv格式.通常导入Excel是要上传的,然后获取文件的路径,这里 ...
- 生产环境nginx配置文件(带https安全认证)
#user www www; worker_processes 2; error_log logs/error.log info; pid /usr/local/nginx/nginx.pid; wo ...
- python 常用turtle
python 常用turtle 常用命令1 import turtle turtle.bgcolor("black") 设置背景颜色 turtle.onscreenclick(x, ...
- Linux下/proc目录的作用
文章是摘抄过来,方便自己查阅! 1. /proc目录 Linux 内核提供了一种通过 /proc 文件系统,在运行时访问内核内部数据结构.改变内核设置的机制.proc文件系统是一个伪文件系统,它只存在 ...
- MariaDB xtrabackup物理备份与还原
xtrabackup物理备份 1.1 安装xtraback 安装依赖: [root@localhost ~]# yum install -y perl-DBD-MySQL perl-DBI perl- ...
- 5.1JAVA基础复习——JAVA中的静态代码块、构造代码块、构造函数、局部代码块区别
构造代码块: 在类中定义可以给所有对象进行初始化.局部代码块: 在方法中定义属性的生命周期.静态代码块: 在类中定义用于给类调用时属性的初始化 构造函数与构造代码块的区别: 构造函数是给对应的对象进行 ...
- 【sed】增加一列【shell文本处理】
有些简单的文本处理不需要写程序,利用awk和sed就可以很好的完成. 今天记录一下在已有文件中增加一列的方法 sed -i "s/^/Chr${i}\t&/g" file ...
- Qt文档阅读笔记-QGraphicsItem::paint中QStyleOptionGraphicsItem *option的进一步认识
官方解析 painter : 此参数用于绘图;option : 提供了item的风格,比如item的状态,曝光度以及详细的信息:widget : 想画到哪个widget上,如果要画在缓存区上,这个参数 ...