解決Navicat數(shù)據(jù)庫(kù)連接成功但密碼忘記的問(wèn)題
解決方法
一:通過(guò)注冊(cè)表找到數(shù)據(jù)庫(kù)連接的密碼,再通過(guò)PHP解密
具體操作:
1.用 win + R 快捷鍵打開(kāi)運(yùn)行窗口,輸入 regedit 打開(kāi)注冊(cè)表
2.在注冊(cè)表地址欄輸入下面內(nèi)容,查找Navicat密碼保存位置,回車(chē):
計(jì)算機(jī)\HKEY_CURRENT_USER\SOFTWARE\PremiumSoft\Navicat\Servers
3.在servers目錄下,找到需要找回密碼的連接,鼠標(biāo)左鍵點(diǎn)擊,右側(cè)下拉找到名稱(chēng)為 pwd 的一項(xiàng),該項(xiàng)的數(shù)據(jù)即為密碼。右鍵,點(diǎn)擊修改,復(fù)制數(shù)據(jù):
4.使用 https://tool.lu/coderunner/ 在線(xiàn)工具,對(duì)復(fù)制下來(lái)的密碼15057D7BA390進(jìn)行解密
5.將以下php解密代碼復(fù)制到在線(xiàn)工具中,將復(fù)制的數(shù)據(jù)粘貼到代碼的倒數(shù)第二行,點(diǎn)擊執(zhí)行,即可得到密碼
PS:該工具首行不能空行,否則執(zhí)行會(huì)報(bào)錯(cuò);另外,在代碼倒數(shù)五六行需要指定Navicat版本
<?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";
二:通過(guò)Navicat導(dǎo)出連接,找到連接密碼,再通過(guò)PHP進(jìn)行解密
具體操作:
1.打開(kāi)Navicat,導(dǎo)航欄點(diǎn)擊“文件”,點(diǎn)擊“導(dǎo)出連接”,
2.選擇自己需要找回密碼的連接,并勾選左下角“導(dǎo)出密碼”,點(diǎn)擊“確定”
3.打開(kāi)導(dǎo)出的文件,找到Password這一項(xiàng),將引號(hào)中的數(shù)據(jù)復(fù)制下來(lái)
4.打開(kāi)并使用方法一步驟4.中的在線(xiàn)工具和代碼,修改倒數(shù)第二行的內(nèi)容為步驟三保存的數(shù)據(jù)833E4ABBC56C89041A9070F043641E3B,點(diǎn)擊運(yùn)行
PS:由于我使用的是Navicat 12,在這種方法中需要修改代碼中倒數(shù)第五六行的版本,否則解析出來(lái)亂碼
以上就是解決Navicat數(shù)據(jù)庫(kù)連接成功但密碼忘記的問(wèn)題的詳細(xì)內(nèi)容,更多關(guān)于Navicat數(shù)據(jù)庫(kù)密碼忘記的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
詳解數(shù)據(jù)庫(kù)中跨庫(kù)數(shù)據(jù)表的運(yùn)算
跨庫(kù)數(shù)據(jù)表,是指邏輯上同一張數(shù)據(jù)表被分別存儲(chǔ)在不同數(shù)據(jù)庫(kù)中。接下來(lái)通過(guò)本文給大家介紹數(shù)據(jù)庫(kù)中跨庫(kù)數(shù)據(jù)表的運(yùn)算方法,感興趣的朋友跟隨小編一起看看吧2018-11-11MyISAM與InnoDB索引實(shí)現(xiàn)對(duì)比詳解
這篇文章主要給大家介紹了關(guān)于MyISAM與InnoDB索引實(shí)現(xiàn)對(duì)比的相關(guān)資料,文中通過(guò)圖文介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09利用帶關(guān)聯(lián)子查詢(xún)Update語(yǔ)句更新數(shù)據(jù)的方法
這篇文章主要介紹了利用帶關(guān)聯(lián)子查詢(xún)Update語(yǔ)句更新數(shù)據(jù)的方法,需要的朋友可以參考下2014-08-08Navicat快速導(dǎo)入和導(dǎo)出sql文件的方法
Navicat是MySQL非常好用的可視化管理工具,功能非常強(qiáng)大,能滿(mǎn)足我們?nèi)粘?shù)據(jù)庫(kù)開(kāi)發(fā)的所有需求。今天教大家如何導(dǎo)入和導(dǎo)出SQL文件,感興趣的朋友跟隨小編一起看看吧2021-05-05MySQL與Oracle 差異比較之四條件循環(huán)語(yǔ)句
這篇文章主要介紹了MySQL與Oracle 差異比較之四條件循環(huán)語(yǔ)句,需要的朋友可以參考下2017-04-04梧桐數(shù)據(jù)庫(kù)與`mysql`及`oracle`關(guān)于交換服務(wù)器編號(hào)的`SQL`寫(xiě)法分析(推薦)
本文介紹了如何通過(guò)SQL查詢(xún)實(shí)現(xiàn)服務(wù)器編號(hào)的交換操作,以?xún)?yōu)化數(shù)據(jù)中心內(nèi)部服務(wù)器的布局,文章說(shuō)明了不同數(shù)據(jù)庫(kù)(如梧桐數(shù)據(jù)庫(kù)、MySQL和Oracle)的建表語(yǔ)句、數(shù)據(jù)插入以及SQL實(shí)現(xiàn)思路,通過(guò)具體的SQL查詢(xún),文章展示了如何在不同數(shù)據(jù)庫(kù)中交換服務(wù)器編號(hào),并解釋了每個(gè)部分的功能2024-11-11dbeaver批量導(dǎo)出數(shù)據(jù)到另一個(gè)數(shù)據(jù)庫(kù)的詳細(xì)圖文教程
DBeaver是一款數(shù)據(jù)庫(kù)管理軟件,小巧易用,最主要其官方版就可以滿(mǎn)足平常得任務(wù)需求,這篇文章主要給大家介紹了關(guān)于dbeaver批量導(dǎo)出數(shù)據(jù)到另一個(gè)數(shù)據(jù)庫(kù)的相關(guān)資料,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下2024-03-03