赞
踩
目录
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
服务器安装mysql登录时报
service mysqld status
(若是Failed,检查是否有多个版本mysql且占用着3306端口号,如有则关闭,service mysqld restart)
grep "A temporary password is generated for root@localhost" /var/log/mysqld.log
(查看生成的临时密码)
mysql -uroot -p
(如图所示版本号为5.7.32 ,8*版本的结尾处有特殊标注)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
报错
(莫慌)
- show variables like '%validate_password_policy%';
- show variables like '%validate_password_length%';
如图
- set global validate_password_policy=0;
- set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
flush privileges;
quit;
mysql -uroot -p
show databases;
- use mysql; #访问mysql库
- update user set host = '%' where user = 'root'; #使root能再任何host访问
- FLUSH PRIVILEGES; #刷新
标注8*版本需要注意
- #查看密码策略
- show variables like '%validate_password.policy%';
- show variables like '%validate_password.length%';
- #修改密码策略
- set global validate_password.policy=0; #设置为弱口令
- set global validate_password.length=1; #密码最小长度为1
任何的限制,都是从内心开始的!
当你不再忍耐,不再克制,才会真正的成熟!
在做任何事情时,都要有坚定且清晰的目标,还要牢记目标!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。