Home  >  Article  >  Database  >  linux mysql 破解root 密码

linux mysql 破解root 密码

WBOY
WBOYOriginal
2016-06-07 15:33:311173browse

Unix linux 第一:首先要把mysqld停止,最好都kill掉 killall mysqld 第二:启动mysql,但是要跳过权限表 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables 第三:进去mysql,并修改密码 /usr/local/mysql/bin/mysql -u root mysqluse mysql; mysqlupd

Unix && linux
第一:首先要把mysqld停止,最好都kill掉
killall mysqld
第二:启动mysql,但是要跳过权限表
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
第三:进去mysql,并修改密码
/usr/local/mysql/bin/mysql -u root
mysql>use mysql;
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
mysql>\q
第四:重新启动mysql,正常进入。

Windows
第一:进入Windows窗口命令行下,停止mysql服务: net stop mysql
第二:进入mysql的安装目录下,进去bin目录
mysqld-nt.exe --skip-grant-tables
第三:再另一个窗口下,进去mysql的安装目录,并修改密码:
执行mysql.exe
>use mysql;
>update set user password=password("new_pass") where user="root";
>flush privileges;
>\q
第四:结束mysqld-nt进程,重新启动mysql


在windows中,如果上面的方法无法解决,可以在my.ini中的[MySQLd]配置段添加如下一行:
skip-grant-tables

然后保存,再重启mysql,最后使用mysql -uroot 即可使用root用户进入。

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