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

查看:82
本文介绍了如何获取我的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天全站免登陆