Home > Database > Mysql Tutorial > body text

忘记密码MySQL的恢复方法

WBOY
Release: 2016-06-07 17:51:17
Original
944 people have browsed it

本文章今天的介绍关于MySQL忘记密码恢复密码的实现方法,如果碰到这种问题的朋友可以根据这篇文章参考一下找回mysql密码的吧。

1. 向d server 发送kill命令关掉mysqld server(不是 kill -9),存放进程ID的文件通常在MYSQL的所在的目录中。

 代码如下 复制代码
killall -TERM mysqld

你必须是UNIX的root用户或者是你所运行的SERVER上的同等用户,才能执行这个操作。
2. 使用`--skip-grant-tables' 参数来启动

 代码如下 复制代码
mysqld。 (LINUX下/usr/bin/safe_mysqld --skip-grant-tables , windows下c:mysqlbinmysqld --skip-grant-tables)

3. 然后无密码登录到mysqld server ,

 代码如下 复制代码
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;

。你也可以这样做:`

 代码如下 复制代码
mysqladmin -h hostname -u user password 'new password''。

 

4. 载入权限表:

 代码如下 复制代码
`mysqladmin -h hostname flush-privileges' ,或者使用 SQL 命令`FLUSH PRIVILEGES'。
5.killall -TERM mysqld

6.用新密码登陆

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!