标签归档:mysql破解密码

Windows下MySQL(MariaDB)数据库破解各版本root密码

方法一:(适用于MySQL5.0/5.1/5.2/5.5)

开始-运行-cmd 输入以下命令停止mysql,或者 开始-运行-services.msc 找到mysql服务并停止。

D:\MySQL\MySQL Server 5.2\bin>Net stop mysql

到mysql的具体安装路径BIN目录下执行:

D:\MySQL\MySQL Server 5.2\bin>mysqld-nt --skip-grant-tables
或
D:\MySQL\MySQL Server 5.2\bin>mysqld --skip-grant-tables

当前窗口将会停止。

重开cmd命令窗口到mysql的bin目录直接运行mysql

D:\MySQL\MySQL Server 5.2\bin>mysql
D:\MySQL\MySQL Server 5.2\bin>use mysql;
D:\MySQL\MySQL Server 5.2\bin>update user set password=password("RenwoleNEWPass") where user="root";
D:\MySQL\MySQL Server 5.2\bin>flush privileges;
D:\MySQL\MySQL Server 5.2\bin>exit;

方案二;(适用于mysql5.6/5.7/8.0)
以下操作到mysql安装目录BIN下的执行;

D:\MySQL\MySQL Server 5.6\bin>Net stop mysql
D:\MySQL\MySQL Server 5.6\bin>mysqld --skip-grant-tables
D:\MySQL\MySQL Server 5.6\bin>use mysql;
D:\MySQL\MySQL Server 5.6\bin>update mysql.user set authentication_string=password('RenwoleNEWPass') where user='root';
D:\MySQL\MySQL Server 5.6\bin>flush privileges;
D:\MySQL\MySQL Server 5.6\bin>exit;

最后结束mysql进程,重启mysql服务即可。