修改、破解 MariaDB数据库 root 密码

Crq
Crq
管理员
1874
文章
0
粉丝
Linux教程评论82字数 213阅读0分42秒阅读模式

修改、破解 MariaDB数据库 root 密码

修改mysql密码有多种方案下面介绍2个

方案一
 # /usr/local/mysql/bin/mysqladmin -uroot -p password "New-password"
 Enter password: 【输入原有密码】 //输入后回车密码就修改成了New-password
方案二
 # mysql -uroot -p //回车登录mysql系统
 Enter password: 【输入原来的密码】
 MariaDB [(none)]> use mysql; //进入mysql数据库
 MariaDB [(none)]> update user set password=passworD("New-password") where user='root';
 MariaDB [(none)]> flush privileges; //刷新数据库
 MariaDB [(none)]> exit; //退出

修改完成!

如果你不记得之前的老密码,那么只能尝试破解,破解方案以下:

前置条件:必须拥有服务器最高管理员(root)权限。

 # systemctl stop mysql
 # /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &

“&” 表示在后台运行,若不再后台运行,就再打开一个终端。

# mysql
 MariaDB [(none)]> use mysql;
 MariaDB [(none)]> UPDATE user SET password=password("New-password") WHERE user='root';
 MariaDB [(none)]> flush privileges;
 MariaDB [(none)]> exit;

破解完成!

weinxin
我的微信
微信号已复制
我的微信
这是我的微信扫一扫
 
Crq
  • 本文由 Crq 发表于2024年9月1日 01:54:39
  • 转载请注明:https://www.cncrq.com/10585.html
【技术快报】9.12-9.18 Linux教程

【技术快报】9.12-9.18

本期《linux就该这么学》的技术周报中,将为您推出Nginx源码安装及调优配置、国内三大云数据库测试对比、12个Linux进程管理命令介绍、怎样在Ubuntu中修改默认程序、在a...
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证