1.Mysql5.7 Password;mysql
查找臨時密碼:grep "A temporary password" /var/log/mysqld.logsql
修改臨時密碼:alter user root@'localhost' identified by '!QAZ2wsx';# ERROR 1819 (HY000): Your password does not satisfy the current policy requirementsshell
查看密碼策略:SHOW VARIABLES LIKE 'validate_password%'; oracle
查看密碼插件: show plugins;配置文件[mysqld]標籤中添加 validate_passwor=offide
注意:5.7後,MySQL的 mysql.user 表中的密碼字段由以前的 password 改成 authentication_string工具
經驗:因此在數據從5.x遷移到5.7後,須要作更新mysql操做: mysql_upgrade -uroot -pui
無臨時密碼方法:spa
無密碼啓動:mysqld_safe --skip-grant-tables &插件
查看密碼:select user,host,authentication_string,password_expired from user;blog
重設密碼 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"