数据库密码的破解5

系列文章目录

数据库密码的破解5


一、更改密码(知道原始密码)

[root@server15 mysql]# mysqladmin -uroot -p password 
Enter password: 
New password: 
Confirm new password: 

二、更改密码(不知道原先密码)

1.跳过授权表进入数据库

[root@server15 mysql]# mysqld_safe --skip-grant-tables & 
跳过授权表打开数据库 &后台运行
[2] 5479
[root@server15 mysql]# 210726 18:12:13 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
210726 18:12:13 mysqld_safe A mysqld process already exists
[root@server15 mysql]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

2.修改密码

在这里插入图片描述
3.更改里面的这个字段

在这里插入图片描述

MariaDB [(none)]> UPDATE mysql.user SET authentication_string=password('123') WHERE User='root';rhel8
MariaDB [(none)]> UPDATE mysql.user SET Password=password('123') WHERE User='root';   rhel7

4.查看mysql的所有进程并且关闭掉

[root@server15 mysql]# ps aux | grep mysql
root      5297  0.0  0.1 113312  1632 pts/0    S    18:10   0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql     5455  0.0  8.6 970848 88272 pts/0    Sl   18:10   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root      5620  0.0  0.0 112708   972 pts/0    R+   18:20   0:00 grep --color=auto mysql
[root@server15 mysql]# kill -9 5297
[root@server15 mysql]# kill -9 5455
ps aux | grep mysql
root      5624  0.0  0.0 112708   976 pts/0    R+   18:22   0:00 grep --color=auto mysql 这个是grep的进程

5.更改完成

[root@server15 mysql]# systemctl start mariadb.service 
[root@server15 mysql]#  mysql -uroot -p123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> 

END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值