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";
相关推荐
ofoxcoding1 分钟前
Redis 缓存穿透怎么解决?3 种方案实测 + 踩坑全记录(2026)
数据库·redis·缓存·ai
布谷歌1 分钟前
高效查询商户日终余额:一个SQL的优化实践
数据库·sql
EAIReport9 分钟前
深入浅出理解Token技术计算方式:从原理到实战
linux·运维·服务器
kaixiang30012 分钟前
若依RuoYi实战
java·服务器·前端
m0_7381207212 分钟前
AI安全——Gandalf靶场 Gandalf Adventure 全关卡绕过详解
服务器·人工智能·安全·web安全·ai·prompt
xiaoliuliu1234513 分钟前
Visual Studio Code 2024安装与汉化教程 Windows版:解压+管理员运行+自定义路径+中文插件指南
linux·运维·服务器
添柴少年yyds13 分钟前
信贷表关联字段
数据库·sql·mysql
小张努力向上up19 分钟前
ubuntu server 远程服务器安装中文输入法 支持中文环境
linux·服务器·ubuntu
一 乐21 分钟前
智能农田管理|基于springboot + vue智能农田管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·智能农田管理系统
倔强的石头10622 分钟前
kingbase备份与恢复实战(三)—— 表-模式级备份与误删表精准恢复(sys_dump+sys_restore)
数据库·kingbase