如何解決Navicat已經(jīng)成功連接,密碼忘記的問題
一直想寫一下這篇文章的總結(jié),因為有時真的忘記了,要去網(wǎng)上重新搜索一下之前用過的方法,因此這里記錄一下,也為了以后遇到這種問題可以直接看我的文章,而不是到處找,以下為實踐篇。
1. 如果是win,通過注冊表里去找對應(yīng)的數(shù)據(jù),用php解碼
去cmd里輸入
regedit
去到對應(yīng)的注冊表
查找Navicat的密碼保存位置
去到對應(yīng)的路徑下面
計算機(jī)\HKEY_CURRENT_USER\Software\PremiumSoft
可以看到
打開對應(yīng)的目錄,尋找一下servers下要找的數(shù)據(jù)庫,如我要找阿里云的密碼
尋找pwd找出來,復(fù)制數(shù)據(jù)
去到
https://tool.lu/coderunner/
復(fù)制黏貼一下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";
將15057D7BA390復(fù)制到倒數(shù)第二行
點(diǎn)擊執(zhí)行,得到密碼
2. linux/win/蘋果桌面情況下,可導(dǎo)出連接看然后去php解密(適用)
導(dǎo)出后用notepad++看里面的代碼
尋找password值
復(fù)制888B51B60B5FF32FAF86AC去第一種方法php方法里解密
3. 直接登錄navicat,用命令去改密碼
通過Navicat Premium能登陸MySQL,但root用戶密碼忘記了
方法: 用UPDATE直接編輯user表
mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES;
總結(jié)
- 從操作上沒有卡手的地方
- 不太明白為什么說php是最好的語言,猜測用java寫出來也是可以解密的
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
一個查詢的SQL語句請教,希望能夠用一條SQL語句得到結(jié)果
一個查詢的SQL語句請教,希望能夠用一條SQL語句得到結(jié)果...2007-06-06Navicat?premium?for?mac?12的安裝破解圖文教程
Navicat Premium是一款數(shù)據(jù)庫管理工具,將此工具連接數(shù)據(jù)庫,你可以從中看到各種數(shù)據(jù)庫的詳細(xì)信息,這篇文章主要介紹了Mac下Navicat?premium?for?mac?12的安裝破解過程,需要的朋友可以參考下2024-01-01利用DataSet部分功能實現(xiàn)網(wǎng)站登錄
這篇文章主要介紹了利用DataSet部分功能實現(xiàn)網(wǎng)站登錄 ,需要的朋友可以參考下2017-05-05Access和SQL Server里面的SQL語句的不同之處
做了一個Winform的營養(yǎng)測量軟件,來回的搗騰著Access數(shù)據(jù)庫,還是那幾句增刪改查,不過用多了,發(fā)現(xiàn)Access數(shù)據(jù)庫下的SQL語句和SQL Server下正宗的SQL還有有很大的不同。2009-12-12數(shù)據(jù)庫設(shè)計規(guī)范化的五個要求 推薦收藏
通常情況下,可以從兩個方面來判斷數(shù)據(jù)庫是否設(shè)計的比較規(guī)范。一是看看是否擁有大量的窄表,二是寬表的數(shù)量是否足夠的少。2011-04-04在SQL Server和Oracle中創(chuàng)建job
有的時候,我們可能需要在數(shù)據(jù)庫中設(shè)定一些自動執(zhí)行的任務(wù)(job),以此來自動完成一些包括統(tǒng)計、備份方面的需求,下面就簡單說明一下有關(guān)ms server和oracle兩種數(shù)據(jù)庫中如何新建自動任務(wù)。2009-06-06快速解決openGauss數(shù)據(jù)庫pg_xlog爆滿問題
這篇文章主要介紹了openGauss數(shù)據(jù)庫pg_xlog爆滿問題解決,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-04-04