Home  >  Article  >  Database  >  MySQL密码丢失的找回方法(win/linux/Unix)

MySQL密码丢失的找回方法(win/linux/Unix)

WBOY
WBOYOriginal
2016-06-07 17:51:191086browse

本文章介绍了是关于MySQL密码丢失找回方法主要是包括在三种系统windows,linux,unix这三种操作系统,有需要的朋友可以参考一下。

破解本地密码:
Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:,进入C:mysqlbin
4.跳过权限检查启动MySQL,

 代码如下 复制代码
c:mysqlbin>mysqld-nt --skip-grant-tables

5.重新打开一个窗口,进入c:mysqlbin目录,设置root的新密码

 代码如下 复制代码
c:mysqlbin>mysqladmin -u root flush-privileges password "newpassword"
c:mysqlbin>mysqladmin -u root -p shutdown

将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。

Unix&Linux:
1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用--skip-grant-tables参数启动MySQL Server

 代码如下 复制代码
shell>mysqld_safe --skip-grant-tables &

4.为root@localhost设置新密码

 代码如下 复制代码
shell>mysqladmin -u root flush-privileges password "newpassword"

5.重启MySQL Server

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn