Home  >  Article  >  Database  >  恢复mysql管理员密码_MySQL

恢复mysql管理员密码_MySQL

WBOY
WBOYOriginal
2016-06-01 13:47:41858browse

bitsCN.com

1、向mysqld server 发送kill命令关掉mysqld server(不是 kill -9),存放进程ID的文件通常在MYSQL的数据库所在的目录/var/lib/mysql中。
 

# killall -TERM mysqld

2、使用--skip-grant-tables参数来启动 mysqld。
 

# /usr/bin/safe_mysqld --skip-grant-tables

路径不一定都一样,可以用locate找一下。
3、然后就可以无密码登录到mysqld server ,此时Mysql的密码和刚安装时一样,都是为空。现在我们可以使用mysqladmin来改变mysql的密码了。
 

#mysqladmin -u root -p password newpassword

4、载入权限表,使用下面的命令
 

# mysqladmin flush-privileges

bitsCN.com
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