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";
相关推荐
Watink Cpper3 小时前
[Redis] Redis:高性能内存数据库与分布式架构设计
linux·数据库·redis·分布式·架构
孤寂大仙v3 小时前
【计算机网络】应用层协议Http——构建Http服务服务器
服务器·计算机网络·http
捏尼卜波卜4 小时前
TCP 三次握手
服务器·网络·tcp/ip
小艺E5 小时前
24核32G,千兆共享:裸金属服务器的技术原理与优势
运维·服务器
编程小能手@5 小时前
【计算机网络】子网划分
服务器·网络·计算机网络
中云时代-防御可测试-小余6 小时前
怎么选择合适的高防IP
服务器·网络·网络协议·tcp/ip·阿里云·udp·ddos
惜.己6 小时前
MySql(十)
数据库·mysql
瓯雅爱分享8 小时前
MES管理系统:Java+Vue,含源码与文档,实现生产过程实时监控、调度与优化,提升制造企业效能
java·mysql·vue·软件工程·源代码管理
小虾米vivian8 小时前
达梦数据库:同1台服务器如何启动不同版本的DMAP服务
运维·服务器
lichenyang4539 小时前
使用react进行用户管理系统
数据库