当前位置:Gxlcms > 数据库问题 > Mysql8.0忘记密码

Mysql8.0忘记密码

时间:2021-07-01 10:21:17 帮助过:42人阅读

select host, user, authentication_string, plugin from user

 

host: 允许用户登录的ip‘位置’%表示可以远程;

 

user:当前数据库的用户名;

 

authentication_string: 用户密码;在mysql 5.7.9以后废弃了password字段和password()函数;

 

plugin: 密码加密方式;

3.2 如果当前root用户authentication_string字段下有内容,先将其设置为空;

    1. use mysql;  
    2.  update user set authentication_string=‘‘ where user=‘root‘;
    3. update user set password_expired=‘N‘ where user=‘root‘;
    4.  flush privileges;
    5. exit;
    6. 3.3 退出mysql, 删除/etc/my.cnf文件最后的 skip-grant-tables 重启mysql服务;
    7. service mysqld restart 
    8. 3.4 使用root用户进行登录,因为上面设置了authentication_string为空,所以可以免密码登录;
      1.   

  

3.5使用ALTER修改root用户密码

ALTER user ‘root‘@‘localhost‘ IDENTIFIED BY ‘Zhige123#‘;

 

至此修改成功; 从新使用用户名密码登录即可;

 

 

 

 

Mysql8.0忘记密码

标签:div   无法   host   初始化   mys   source   表示   line   ace   

人气教程排行