您好,欢迎访问上海聚搜信息技术有限公司官方网站!
24小时咨询热线:4000-747-360

阿里云代理商阿里云服务器mysql 忘记root密码破解root密码破解所有用户密码,shell脚本

时间:2021-07-26 22:06:29 点击:

  阿里云代理商阿里云服务器mysql 忘记root密码破解root密码破解所有用户密码,shell脚本

  #!/bin/bash

  # mysql 破解重置root密码

  read -p "

  Hello, welcome to continuous integration 4526.cn mysql 同时破解远程和localhost数据库密码

  请输入用户名:" setuser

  read -p "请自定义密码:" setpasswd

  mycnf="/etc/my.cnf"

  NR=`cat -n $mycnf | grep "\[mysqld" | awk -F" " '{print $1}'` ; echo $NR

  # 找到 [mysqld] 标签所在行

  sed -i "/skip-grant-tables/d" $mycnf

  # 删除这个root免密登录配置,重新添加

  sed -i "$NR a skip-grant-tables" $mycnf ; systemctl restart mysqld

  # 在mysqld 标签下面增加免密登录配置信息

  # 重启数据库

  echo "您输入的信息为:$setuser $setpasswd"

  mysql -e "use mysql;select user,authentication_string from user; set global read_only=0;set global read_only=1; set global validate_password.policy=0 ; set global validate_password.length=6;flush privileges;alter user '$setuser'@'localhost' identified by '$setpasswd';alter user '$setuser'@'%' identified by '$setpasswd';"

  # 登录数据库修改root密码为:4526.cn

  # 重点:set global read_only=0;set global read_only=1; flush privileges;set global validate_password.policy=0 ; set global validate_password.length=6;

  # 关掉新主库的只读属性,读写属性,密码长度为6

  sed -i "/skip-grant-tables/d" $mycnf; systemctl restart mysqld

  # 删除之前的配置,重启数据

  阿里云代理商

  聚搜

  上海聚搜信息技术有限公司

  阿里云代理商网站:http://www.4526.cn/

  阿里云代理商云店:https://partner.aliyun.com/shop/1690271921397837

  阿里云优惠券链接:http://aliyun.jusoucn.com/

  Q/V :582059487    TEL:150-2661-2550

标签

收缩
  • 电话咨询

  • 4000-747-360
微信咨询 获取代理价(更低折扣)
更低报价 更低折扣 代金券申请
咨询热线: 15026612550