如何找回我的 MySQL 用户名和密码? [英] How do I retrieve my MySQL username and password?

查看:31
本文介绍了如何找回我的 MySQL 用户名和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我丢失了 MySQL 用户名和密码.我如何找回它?

I lost my MySQL username and password. How do I retrieve it?

推荐答案

停止 MySQL 进程.

Stop the MySQL process.

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

Start the MySQL process with the --skip-grant-tables option.

使用 -u root 选项启动 MySQL 控制台客户端.

Start the MySQL console client with the -u root option.

列出所有用户;

SELECT * FROM mysql.user;

重置密码;

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


但是不要忘记

停止 MySQL 进程

Stop the MySQL process

正常启动 MySQL 进程(即没有 --skip-grant-tables 选项)

Start the MySQL Process normally (i.e. without the --skip-grant-tables option)

当你完成时.否则,您的数据库的安全性可能会受到威胁.

when you are finished. Otherwise, your database's security could be compromised.

这篇关于如何找回我的 MySQL 用户名和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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