1.Mysql5.7 Password;
查找临时密码:grep "A temporary password" /var/log/mysqld.log
修改临时密码:alter user root@'localhost' identified by '!QAZ2wsx';# ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看密码策略:SHOW VARIABLES LIKE 'validate_password%';
查看密码插件: show plugins;配置文件[mysqld]标签中添加 validate_passwor=off
注意:5.7后,MySQL的 mysql.user 表中的密码字段由之前的 password 改为 authentication_string
经验:所以在数据从5.x迁移到5.7后,需要做更新mysql操作: mysql_upgrade -uroot -p
无临时密码方法:
无密码启动:mysqld_safe --skip-grant-tables &
查看密码:select user,host,authentication_string,password_expired from user;
重设密码 update user set authentication_string=password('123abc') where user='root'; flush privileges;
修改MySQL密码方式:
法1:update user set authentication_string=password('123abc') where user='root';
法2:set password=password('newpassword');
法3:alter user root@'localhost' identified by 'oracle';
法4:在shell下使用MySQL工具:mysqladmin -uroot -poldpassword pasword "newpassword"