如果:MySQL 5.7.6 and later:则内容为:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:则为:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
2. 再关闭mysql,service mysqld stopmysqld --init-file=/home/huang800336/doc/mysql-init.txt -u root密码过期mysql 内执行 修改密码永不过期。
启动mysql,增加init-file参数,
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER或者
SET GLOBAL default_password_lifetime = 0; -- never 全局用户或者
ALTER USER 'root'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY; -- 90 days