【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服务器的时候,设置的密码本来好好的,隔了几分钟发现不能访问数据库任何数据。折腾了五六个小时发现找到解决方案。

问题原因:

  • 你的当前密码,过期了

解决方案:【本方案适合ubuntu、centos等系统】

  • step1:使用免权限模式,重启数据库
  • step2:进入数据库,把名为mysql的数据库的user表中的root用户的密码,过期字段从Y改为N。意思是从'已经过期修改为'不过期状态'
  • step3: 关闭免权限模式,重启数据库,重新登录即可

 


 

1. 找到centos系统中的此文件。

  • 找到/etc/my.cnf文件。在文件末尾加上图中内容

2. 重启mysql

1 service mysqld restart

3. 登录数据库后修改密码不过期

4. 把my.cnf文件还原。解除免密模式

5. 重启mysql

1  service mysqld restart

6. 输入密码登录即可

posted @ 2018-11-07 11:33  乙侍  阅读(176)  评论(0)    收藏  举报