如何查看navichat的mysql root密码

请问如何查看mysql的root密码
用navichat打开
目前已经登录

  1. 先导出连接,并且勾选导出密码

    img


    img

  2. 用文本编辑器打开导出的文件,是xml格式的,很好看懂,连接的Password属性是密文(16进制)

  3. 先把密码从16进制转化为二进制数组,然后再用AES CBC模式解密,密钥"libcckeylibcckey",偏移"libcciv libcciv "(中间和末尾有空格),比如java代码

    public class Main {
    
     public static void main(String[] args) throws Exception {
         String aesKey = "libcckeylibcckey";
         String aesIv = "libcciv libcciv ";
         String password = "503AA930968F877F04770B47DD731DC0";// root
    
         SecretKeySpec secretKeySpec = new SecretKeySpec(aesKey.getBytes(StandardCharsets.UTF_8), "AES");
         IvParameterSpec iv = new IvParameterSpec(aesIv.getBytes(StandardCharsets.UTF_8));
    
         Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
         cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, iv);
    
         byte[] bytes = hexToBytes(password);
         byte[] decrypted = cipher.doFinal(bytes);
         System.out.println(new String(decrypted, StandardCharsets.UTF_8));
     }
    
     private static byte[] hexToBytes(String hex) {
         int hexlen = hex.length();
         byte[] result;
         if (hexlen % 2 == 1) {
             //奇数
             hexlen++;
             result = new byte[(hexlen / 2)];
             hex = "0" + hex;
         } else {
             //偶数
             result = new byte[(hexlen / 2)];
         }
         int j = 0;
         for (int i = 0; i < hexlen; i += 2) {
             result[j] = (byte) Integer.parseInt(hex.substring(i, i + 2), 16);
             j++;
         }
         return result;
     }
    }
    
  4. 或者直接使用在线解密工具:


    img

密码不能看,但是可以重置。

加密的,看不了的

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^