gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 07:57:09 25 4
gpt4 key购买 nike

我忘记了 MySQL 中一个用户的密码。有没有办法恢复 MySQL 用户密码?

最佳答案

您无法恢复,但您可以设置一个不同的:

像这样:

  • 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 进程。

或者,

无需重启MySQL服务器。

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

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

--skip-grant-options 使任何人都可以在没有密码和所有权限的情况下进行连接。因为这是不安全的,你可能想要

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

来自:引用:resetting-permissions-generic

关于mysql - 有没有办法恢复 MySql 用户密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9251261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com