有没有办法恢复MySql用户密码?

编程入门 行业动态 更新时间:2024-10-24 01:58:47
本文介绍了有没有办法恢复MySql用户密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我忘记了MySQL中一位用户的密码.有办法恢复MySQL用户密码吗?

I forgot the password to one of the user in MySQL. Is there a way to recover MySQL user Password?

推荐答案

您不能恢复,但可以设置其他设置:

像这样:

  • 停止&使用--skip-grant-tables选项启动MySQL进程.
  • 登录到root用户
    • Stop & start the MySQL process with --skip-grant-tables option.
    • Login to root user
    • 列出所有用户;

      SELECT * FROM mysql.user;

      重置密码;

      UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';

      不使用--skip-grant-tables选项重新启动MySQL进程.

      restart the MySQL Process without the --skip-grant-tables option.

      或者

      无需重启MySQL服务器.

      There is no need to restart the MySQL server.

      在更新mysql.user语句后使用FLUSH PRIVILEGES;更改密码.

      use FLUSH PRIVILEGES; after the update mysql.user statement for password change.

      FLUSH语句告诉服务器将授权表重新加载到内存中,以便它注意到密码更改.

      The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.

      通过--skip-grant-options,任何人都可以不使用密码并具有所有特权的方式进行连接.因为这是不安全的,所以您可能要

      The --skip-grant-options enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to

      与-skip-networking 结合使用-skip-grant-tables ,以防止远程客户端连接.

      use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.

      来自:参考:重置-通用权限

更多推荐

有没有办法恢复MySql用户密码?

本文发布于:2023-10-16 00:18:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1495910.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   用户密码   MySql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!