mysql初始化密码常见报错问题
1,mysql5.6是密码为空直接进入数据库的,但是mysql5.7就需要初始密码

cat /var/log/mysqld.log | grep password
1

2,然后执行 mysql -uroot -p ,输入上面的到的密码进入,用该密码登录后,必须马上修改新的密码,不然会报如下错误:

mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

1
2
3
3,如果你想要设置一个简单的测试密码的话,比如设置为123456,会提示这个错误,报错的意思就是你的密码不符合要求

mysql> alter user 'root'@'localhost' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

1
2
3
.
这个其实与validate_password_policy的值有关。

validate_password_policy有以下取值:

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
有时候,只是为了自己测试,不想密码设置得那么复杂,譬如说,我只想设置root的密码为123456。
必须修改两个全局参数:

首先,修改validate_password_policy参数的值

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
1
2
validate_password_length(密码长度)参数默认为8,我们修改为1

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)
1
2
4,完成之后再次执行修改密码语句即可成功

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

---------------------
作者:谁还不是小白鼠
来源:CSDN
原文:https://blog.csdn.net/memory6364/article/details/82426052
版权声明:本文为博主原创文章,转载请附上博文链接!

mysql5.7初始化密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before的更多相关文章

  1. mysql5.7初始化密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement

    mysql初始化密码常见报错问题 1,mysql5.6是密码为空直接进入数据库的,但是mysql5.7就需要初始密码 cat /var/log/mysqld.log | grep password 2 ...

  2. MySQL5.7 报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement

    MySQL5.7 报错 : ERROR 1820 (HY000): You must reset your password using ALTER USER statement before exe ...

  3. 第一次登录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 ...

  4. 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 ...

  5. mysql 报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executin

    解决办法1. 修改用户密码mysql> alter user 'root'@'localhost' identified by 'youpassword'; 或者 mysql> set p ...

  6. 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 ...

  7. 【MySQL】ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing

    今天上午遇到了一个问题,新创建的mysql5.7的数据库,由于初始化有点问题,没有给root密码,用了免密码登录. 但是,修改了root密码之后,把配置中的免密登录的配置注释掉后,重启服务.服务正常启 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. miui 系统铃声

    MIUI7-8系统铃声和通知铃声等,从miui system.img中提取出来的: 链接:http://pan.baidu.com/s/1bpH5N5P 密码:tz7p

  2. HAOI2018苹果树

    题解 首先所有生成树的情况树是\(n!\)的,因为第一次有1中方法,第二次有两种放法,以此类推... 然后我们发现距离这种东西可以直接枚举每条边算贡献. 于是我们枚举了一个点\(i\),又枚举了这个点 ...

  3. golang中使用Redis

    一.golang中安装Redis github地址:https://github.com/garyburd/redigo 文档地址:http://godoc.org/github.com/garybu ...

  4. GWAS后续分析:多基因风险评分(Polygenic Risk Score)的计算

    一.什么是多基因风险评分 传统的GWAS研究只计算单个SNP位点与表型之间的关联性,再用Bonferroni校正,通过给定的阈值,筛选出显著的SNP位点. 这样会存在两个问题,第一.Bonferron ...

  5. Servlet生命周期 和 继承关系

    三 servlet的生命周期 (一个servlet类的对象 创建---->销毁) 第一次访问 某个servlet的时候 首先调用其 构造函数 public StudentServlet(){ S ...

  6. ansible安装二进制kubernetes-1.14.1

    主机信息: 主机IP 主机名 角色 10.10.3.181 k8s-m1  kube-apiserver,kube-controller-manager,kube-scheduler,etcd 10. ...

  7. StackExchange.Redis 异步超时解决方案

    Timeout awaiting response (outbound=0KiB, inbound=45417KiB, 5891ms elapsed, timeout is 5000ms), comm ...

  8. mongodb增加新字段报错解决方法

    今天想在项目的一个集合里增加一个新字段 db.article.update({},{$set:{status:0}},{multi:true}) multi : 可选,mongodb 默认是false ...

  9. 关于macOS 管理员(Admin)权限问题。

    最近突然想改下用户名,于是在用户与组里解锁,然后两个手指点击用户那一行,更改fullname,不过出于好奇把uid和uuid也改了. 之后发现current user等级由Admin变成Standar ...

  10. matlab 加根号

    text(3,0.5,'z=0.2$$\sqrt{c/h_0}$$+0.3','interpreter','latex')