1. 新建一个文档,文档内容为:
如果: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 stop启动mysql,增加init-file参数,
mysqld --init-file=/home/huang800336/doc/mysql-init.txt -u root 密码过期 mysql 内执行ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER 或者