我忘记了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用户密码?
发布评论