有没有办法恢复MySql用户密码? [英] Is there a way to recover MySql user Password?

查看:75
本文介绍了有没有办法恢复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用户密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆