当前位置: 首页 > news >正文

MySQL8,Navicat能登陆成功,密码却忘记了

执行成功的图:

以下为步骤:本文一共8个简单步骤。

环境:mysql8、window10、navicat11

1、打开本地电脑window10的命令窗(俗称黑窗口),window+R

2、输入regegit,回车,打开注册表

3、按照此路径【计算机\HKEY_CURRENT_USER\SOFTWARE\PremiumSoft\Navicat\Servers\127.0.0.1本地mysql】找到对应数据库链接的密码

4、复制mysql密码到任意文本中,备用。

5、先打开链接此在线工具:https://tool.lu/coderunner/ ,后复制下面php代码

<?php
class NavicatPassword
{
    protected $version = 0;
    protected $aesKey = 'libcckeylibcckey';
    protected $aesIv = 'libcciv libcciv ';
    protected $blowString = '3DC5CA39';
    protected $blowKey = null;
    protected $blowIv = null;
     
    public function __construct($version = 12)
    {
        $this->version = $version;
        $this->blowKey = sha1('3DC5CA39', true);
        $this->blowIv = hex2bin('d9c7c3c8870d64bd');
    }
     
    public function encrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->encryptEleven($string);
                break;
            case 12:
                $result = $this->encryptTwelve($string);
                break;
            default:
                break;
        }
         
        return $result;
    }
     
    protected function encryptEleven($string)
    {
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
         
        for ($i = 0; $i < $round; $i++) {
            $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));
            $currentVector = $this->xorBytes($currentVector, $temp);
            $result .= $temp;
        }
         
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
         
        return strtoupper(bin2hex($result));
    }
     
    protected function encryptBlock($block)
    {
        return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
    }
     
    protected function decryptBlock($block)
    {
        return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
    }
     
    protected function xorBytes($str1, $str2)
    {
        $result = '';
        for ($i = 0; $i < strlen($str1); $i++) {
            $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));
        }
         
        return $result;
    }
     
    protected function encryptTwelve($string)
    {
        $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
        return strtoupper(bin2hex($result));
    }
     
    public function decrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->decryptEleven($string);
                break;
            case 12:
                $result = $this->decryptTwelve($string);
                break;
            default:
                break;
        }
         
        return $result;
    }
     
    protected function decryptEleven($upperString)
    {
        $string = hex2bin(strtolower($upperString));
         
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
         
        for ($i = 0; $i < $round; $i++) {
            $encryptedBlock = substr($string, 8 * $i, 8);
            $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);
            $currentVector = $this->xorBytes($currentVector, $encryptedBlock);
            $result .= $temp;
        }
         
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
         
        return $result;
    }
     
    protected function decryptTwelve($upperString)
    {
        $string = hex2bin(strtolower($upperString));
        return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
    }
};
 
 
$navicatPassword = new NavicatPassword(11);
$decode = $navicatPassword->decrypt('复制出来的数据库链接密码');
echo $decode."\n";
?>

6、粘贴刚刚复制的php代码到左侧文本框中,下图左侧红框部分

7、将倒数第三行中的密码改为刚才复制到的mysql链接密码,倒数第四行中是navicat版本,输入你电脑上安装的navicat版本。

8、点击右上角【执行】按钮,右侧就会出现解析后的密码。

                    【完】美解决

http://www.lryc.cn/news/377131.html

相关文章:

  • 游戏中的寻路算法研究
  • 【AWS SMB】关于AWS 中小型企业 (SMB) 能力介绍及注意事项
  • 中年之恋:重返青春的旅程
  • 人工智能中的监督学习和无监督学习
  • 深度学习500问——Chapter12:网络搭建及训练(1)
  • HuggingFace CLI 命令全面指南
  • FreeRTOS源码分析
  • python实战:将视频内容上传到社交媒体平台
  • 【深度学习】sdwebui A1111 加速方案对比,xformers vs Flash Attention 2
  • 5分钟了解单元测试
  • VSCode之C/C++插件之宏定义导致颜色变暗
  • 自然语言处理概述
  • 用Rust和Pingora轻松构建超越Nginx的高效负载均衡器
  • 华为云与AWS负载均衡服务深度对比:性能、成本与可用性
  • Vue65-组件之间的传值
  • Java零基础之多线程篇:线程生命周期
  • 技术差异,应用场景;虚拟机可以当作云服务器吗
  • Qt Quick 教程(一)
  • react钩子函数用法(useCallback、useMemo)
  • linux配置Vnc Server给Windows连接
  • Android中的KeyEvent详解
  • 移植案例与原理 - HDF驱动框架-驱动配置(2)
  • 年终奖发放没几天,提离职领导指责我不厚道,我该怎么办?
  • 多处理系统结构
  • 创建进程的常用方式
  • 李宏毅2023机器学习作业HW06解析和代码分享
  • 专业技能篇--算法
  • Vue中CSS动态样式绑定
  • 【漏洞复现】契约锁电子签章平台 add 远程命令执行漏洞(XVE-2023-23720)
  • 计算机专业是否仍是“万金油”?