本文档以实战的形式介绍如何破解MariaDB5.5数据库的root登录密码。忘记root登录密码[root@localhost~]#mysql-uroot-p123ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:YES)找到并运行mysqld_safe程序绕过MariaDB5。5数据库密码认证[root@localhost~]#find/-namemysqld_safe/usr/bin/mysqld_safe[root@localhost~]#/usr/bin/mysqld_safe--skip-grant-tables&直接使用mysql命令登录进入MariaDB5.5数据库,修改root登录密码[root@localhost~]#mysql欢迎使用MariaDB监视器。命令以;结尾或g.您的MariaDB连接ID是1Server版本:5.5.52-MariaDBMariaDBServerCopyright(c)2000,2016,Oracle,MariaDBCorporationAbandothers.Type'help;'或'h'寻求帮助。输入'c'清除当前输入语句。MariaDB[(none)]>showdatabases;Databaseinformation_schemamysqlperformance_schema3rowsinset(0.00sec)MariaDB[(none)]>usemysql;读取表信息完成表名和列名即可关闭此功能以获得更快启动-ADatabasechangedMariaDB[mysql]>UPDATEuserSETpassword=password("New-password")WHEREuser='root';QueryOK,3rowsaffected(0.00sec)Rowsmatched:3Changed:3Warnings:0MariaDB[mysql]>flushprivileges;QueryOK,0rowsaffected(0.00sec)MariaDB[mysql]>exitBye使用新密码New-password登录MariaDB5.5数据库[root@localhost~]#psauUSERPID%CPU%MEMVSZRSSTTY统计开始时间命令root39860.00.11153802084tty1Ss+19:530:02-bashroot224830.00.11153842076pts/0Ss21:540:00-bashroot229100.00.01159252:113925200/bin/sh/usr/bin/mysqld_safe--skimysql230660.34.683926886192点/0Sl21:590:00/usr/libexec/mysqld--basedir=/usrroot230910.00.01510561824点/0R+22:000:00psau[root@localhost~]#kill-922910[root@localhost~]#mysql-uroot-pNew-password欢迎使用MariaDB监视器。通信以;结尾或g.您的MariaDB连接ID是2Server版本:5.5.52-MariaDBMariaDBServerCopyright(c)2000,2016,Oracle,MariaDBCorporationAbandothers.Type'help;'或'h'寻求帮助。键入“c”以清除当前输入语句。MariaDB[(none)]>MariaDB[(none)]>showdatabases;Databaseinformation_schemamysqlperformance_schema3rowsinset(0.00sec)MariaDB[(none)]>exitBye[1]+Killed/usr/bin/mysqld_safe--skip-grant-tables无法使用其他密码登录MariaDB5.5数据库[root@localhost~]#mysql-uroot-pNew-passworddERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:YES)[root@localhost~]#rpm-qamariadbmariadb-5.5.52-1.el7.x86_64总结以上就是破解MariaDB5.5数据库root登录密码的实用方法.希望对大家有所帮助。