https://stackoverflow.com/questions/33387879/mysql-password-expired-cant-connect
MySQL password expiry
Resetting the password will only solve the problem temporarily. From MySQL 5.7.4 to 5.7.10 (to encourage better security - see MySQL: Password Expiration Policy) the default default_password_lifetime variable value is 360 (1 year-ish). For those versions, if you make no changes to this variable (or to individual user accounts) all passwords expire after 360 days.
So from a script you might get the message: "Your password has expired. To log in you must change it using a client that supports expired passwords."
To stop automatic password expiry, log in as root (mysql -u root -p), then, for clients that automatically connect to the server (e.g. scripts.) change password expiration settings:
ALTER USER 'script'@'localhost' PASSWORD EXPIRE NEVER;
OR you can disable automatic password expiration for all users:
SET GLOBAL default_password_lifetime = 0;
As pointed out by Mertaydin in the comments, to make this permanent add the following line to a my.cnf file MySQL reads on startup, under the [mysqld] group of settings. The location of my.cnf depends on your setup (e.g. Windows, or Homebrew on OS X, or an installer), and whether you want this per-user on Unix or global:
[mysqld] default_password_lifetime = 0 (There may be other settings here too...)
See the MySQL docs on configuration files.
在MySQL 5.7.4到5.7.10版本中,由于默认的密码过期策略,所有密码在360天后将过期。当密码过期时,从不支持过期密码的客户端登录会收到'密码已过期'的提示。为了解决这个问题,可以通过以root用户登录并修改特定客户端或所有用户的密码过期设置来停止自动密码过期。永久禁用此功能,需要在MySQL启动时读取的配置文件中添加相关设置。
2497

被折叠的 条评论
为什么被折叠?



