windows远程服务器数据库的搭建和远程访问(Mysql忘记密码通过Navicat连接记录解密密码)

服务器数据库的搭建和远程访问

mysql数据库安装(详细)

window安装mysql详细流程

路程重设MySQL5密码,发现远程服务器原本有一个MySQL5,尝试在服务器本地建立连接被拒绝,因为不知道密码。

(1)注意mysql服务名:否则会报错服务名无效。

(2)MySQL5输入指令跳过密码验证时报错

sql 复制代码
mysqld --skip-grant-tables

安装MySQL的时候报这个错误,由于找不到 VCRUNTIME140_1.dll,无法继续执行代码,重新安装程序可能会解决此问题。
解决 :根据文章,下载安装Visual C++ 2015-2019 Redistributable,双击。

(我看到有人将这个文件拷贝到mysql/bin 目录下,再次执行。怀疑是mysql目录下缺失这个文件导致的。我这样做了之后,远程服务器崩溃了黑屏了,哈哈哈哈哈,我真哈哈哈,被带去机房重启服务器了,然后被要求换了个服务器安装,那个远程服务器有正常的MySQL,可惜了,没法折腾了~~,好吧今日闯祸到此为止...未来可期)

续:

服务器mysql5连不上,应该是密码的问题,问题是不知道密码

(问题是配置文件ini修改了还是不能通过mysqld --skip-grant-tables指令跳过输入密码)

这个博主好厉害啊啊啊啊,通过Navicat连接过数据库,查历史记录来解密

https://www.cnblogs.com/BKYhailong/p/18080385

在线PHP解密工具换这个,真能解

php 复制代码
<?php
namespace FatSmallTools;
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);
    }
}
 
 
 
use FatSmallTools\NavicatPassword;
 
//需要指定版本,11或12
 
//$navicatPassword = new NavicatPassword(12);
 
$navicatPassword = new NavicatPassword(11);
 
 
 
//解密
$decode = $navicatPassword->decrypt('15057D7BA390');
echo $decode."\n";
相关推荐
远方16099 分钟前
61-Oracle SQL Monitor-实操
大数据·数据库·sql·oracle·database
优秀1355 小时前
JDBC
数据库
穆易青9 小时前
2025.06.20【pacbio】|使用Snakemake构建可重复的PacBio全基因组甲基化分析流程
java·运维·服务器
网硕互联的小客服9 小时前
高并发下分布式数据库性能下降的解决方法
数据库·分布式
杜大哥9 小时前
Python:.py文件如何变成双击可执行的windows程序?(版本1)
开发语言·windows·python
远方160910 小时前
59-Oracle 10046事件-知识准备
大数据·数据库·sql·oracle·database
努力成为DBA的小王10 小时前
CVE-2024-6387漏洞、CVE-2025-26465漏洞、CVE-2025-26466漏洞 一口气全解决
运维·服务器
静听山水10 小时前
PostgreSQL/Hologres 外部数据包装器系统表 pg_foreign_data_wrapper 详解
数据库·postgresql
神洛华10 小时前
SQL Server基础语句1:基础查询、数据筛选 / 排序 、分组聚合
数据库·sql
DoWeixin610 小时前
【请关注】mysql一些经常用到的高级SQL
数据库·mysql