zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

mysql密码忘记(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using )

mysql密码密码 Error for &# user root
2023-06-13 09:14:22 时间

一.ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

如上,为密码不正确

操作步骤:

service mysqld stop

编辑/etc/my.cnf 在[mysqld]下加入skip-grant-tables,重启mysql服务可以直接登录

检查authentication_string,plugin

select user,host,plugin,authentication_striong from mysql.user;

将authentication_string设置为空

update user set authentication_striong='' where user='root';

修改密码

alter user 'root'@'%' identified by '666666';

提示不符合密码policy,并查看validate_password%

show variables like 'validate_password%';

set global validate_password.length = 6;

set global validate_password.policy = LOW;

flush privileges;

重新修改密码,

alter user 'root'@'%' identified by '666666';

flush privileges;

重启mysql服务登录后即可。