mysql 5.7 You must reset your password using ALTER USER statement before executing this statement.

问题现象:

mysql 5.7.44 环境里    已经初始化数据库完成,通过初始化密码 mysql -uroot -p 登录,但是在执行sql时报错 :ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

处理办法:

1、执行set password=password(root,'需要设定的密码');

2、设定密码不过期: alter user 'root'@'localhost' password expire never;

3、执行 flush privileges;刷新 

步骤如下图所示

重启mysql 服务:service mysqld restart 

然后 再去使用sql 查询就可以了:

猜你喜欢

转载自blog.csdn.net/yeyuningzi/article/details/134856151
今日推荐