MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。
本文教大家如何重置MariaDB5.5数据库的root登录密码,希望对大家有帮助!

忘记root登录密码
[root@localhost〜]#mysql -uroot -p123
错误1045(28000):用户’root’@’localhost’的访问被拒绝(使用密码:是)
查找并运行mysqld_safe程序绕开MariaDB5.5数据库密码验证
[root@localhost〜]#查找/ -name mysqld_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为1
服务器版本:5.5.52-MariaDB MariaDB服务器
版权所有(c)2000、2016,Oracle,MariaDB Corporation Ab等。
输入“帮助;” 或’ h’寻求帮助。键入“ c”以清除当前输入语句。
MariaDB [(无)]>显示数据库;
+ ——————– +
| 数据库|
+ ——————– +
| information_schema |
| mysql |
| performance_schema |
+ ——————– +
设置3行(0.00秒)
MariaDB [(none)]>使用mysql;
读取表信息以完成表和列名
您可以关闭此功能以使用-A更快地启动
数据库已更改
MariaDB [mysql]> UPDATE用户SET password = password(“ New-password”)WHERE user =’root’;
查询正常,受影响的3行(0.00秒)
匹配的行数:3已更改:3警告:0
MariaDB [mysql]>刷新权限;
查询正常,受影响的0行(0.00秒)
MariaDB [mysql]>退出
再见
使用新密码新密码登录MariaDB5.5数据库
[root @ localhost〜]#ps au
用户PID%CPU%MEM VSZ RSS TTY STAT开始时间命令
根3986 0.0 0.1 115380 2084 tty1 Ss + 19:53 0:02 -bash
根22483 0.0 0.1 115384 2076 pts / 0 Ss 21:54 0:00 -bash
根22910 0.0 0.0 113252 1592 pts / 0 S 21:59 0:00 / bin / sh / usr / bin / mysqld_safe –ski
mysql 23066 0.3 4.6 839268 86192 pts / 0 Sl 21:59 0:00 / usr / libexec / mysqld –basedir = / usr
根23091 0.0 0.0 151056 1824 pts / 0 R + 22:00 0:00 ps au
[root @ localhost〜]#杀死-9 22910
[root @ localhost〜]#mysql -uroot -p新密码
欢迎使用MariaDB监视器。命令以;结尾; 或 g。
您的MariaDB连接ID为2
服务器版本:5.5.52-MariaDB MariaDB服务器
版权所有(c)2000、2016,Oracle,MariaDB Corporation Ab等。
输入“帮助;” 或’ h’寻求帮助。键入“ c”以清除当前输入语句。
MariaDB [(无)]>
MariaDB [(无)]>显示数据库;
+ ——————– +
| 数据库|
+ ——————– +
| information_schema |
| mysql |
| performance_schema |
+ ——————– +
设置3行(0.00秒)
MariaDB [(无)]>退出
再见
[1] +杀死了/ usr / bin / mysqld_safe –skip-grant-tables
使用其他密码不能登录MariaDB5.5数据库
[root @ localhost〜]#mysql -uroot -p新密码
错误1045(28000):用户’root’@’localhost’的访问被拒绝(使用密码:是)
[root @ localhost〜]#rpm -qa mariadb
mariadb-5.5.52-1.el7.x86_64
总结
以上就是重置MariaDB5.5数据库的root登录密码的实战方法,希望能帮助到大家。