破解root密码和破解mysql密码

1. 破解root密码

1.1 启动界面按 e 进入内核

在这里插入图片描述

1.2 输入 rd.break

在这里插入图片描述

1.3 输入图中的命令

在这里插入图片描述

1.4 输入 passwd root 设置新密码

在这里插入图片描述

1.5 输入 touch /.autorelabel

这是关于防火墙的一个设置
在这里插入图片描述

1.6 输入两次 exit退出重启

在这里插入图片描述

2. 破解mysql密码

2.1 修改配置文件

[root@localhost ~]# vi /etc/my.cnf

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[mysqld]
skip-grant-tables  //加入此行,跳过授权表,跳过权限
//我这里是mariadb,mysql的my.cnf是自己编写的,也是直接加入即可

2.2 无密码登录

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.27-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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| school             |
+--------------------+
4 rows in set (0.001 sec)

2.3 设置新密码

MariaDB [school]> select * from mysql.user\G
*************************** 1. row ***************************
                  Host: localhost
                  User: root
              Password: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
           Select_priv: Y
           Insert_priv: Y
           Update_priv: Y
           Delete_priv: Y
           Create_priv: Y
             Drop_priv: Y
           Reload_priv: Y
         Shutdown_priv: Y
          Process_priv: Y
             File_priv: Y
            Grant_priv: Y
       References_priv: Y
            Index_priv: Y
            Alter_priv: Y
          Show_db_priv: Y
            Super_priv: Y
 Create_tmp_table_priv: Y
      Lock_tables_priv: Y
          Execute_priv: Y
       Repl_slave_priv: Y
      Repl_client_priv: Y
      Create_view_priv: Y
        Show_view_priv: Y
   Create_routine_priv: Y
    Alter_routine_priv: Y
      Create_user_priv: Y
            Event_priv: Y
          Trigger_priv: Y
Create_tablespace_priv: Y
   Delete_history_priv: Y
              ssl_type: 
            ssl_cipher: 
           x509_issuer: 
          x509_subject: 
         max_questions: 0
           max_updates: 0
       max_connections: 0
  max_user_connections: 0
                plugin: mysql_native_password
 authentication_string: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9    //修改这个
      password_expired: N
               is_role: N
          default_role: 
    max_statement_time: 0.000000

MariaDB [(none)]> update user set authentication_string = password('123!') where Host = 'localhost' and User = 'root';   

2.4 将配置文件里面添加的内容删除然后重启数据库

[root@localhost ~]# vi /etc/my.cnf

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[mysqld]
skip-grant-tables  //将这个删除,然后保存
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值