JDBC连接MySQL数据库警告:Establishing SSL connection without server’s identity verification is not recommend

JDBC连接MySQL出现如下警告:

Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

原因是高版本MySQL需要指明是否进行SSL连接。

解决方法是在JDBC连接MySQL的URL字符串中加入useSSL=true或者useSSL=false即可,例如:

jdbc:mysql://127.0.0.1:3306/framework?serverTimezone=UTC&characterEncoding=utf8&useSSL=false

如果你的连接确实没有暴露给网络(仅限本地主机),或者你在没有真实数据的非生产环境中工作,那么可以肯定的是:通过包含选项useSSL=false来禁用SSL没有坏处。

如果要使用useSSL=true,需要以下一组选项才能使SSL使用证书、主机验证并禁用弱协议选项:

  • useSSL=true
  • sslMode=VERIFY_IDENTITY
  • trustCertificateKeyStoreUrl=file:path_to_keystore
  • trustCertificateKeyStorePassword=password
  • enabledTLSProtocols=TLSv1.2

因此,作为一个示例,让我们假设你希望使用SSL将其中一种Atlassian产品(Jira、Confluence、Bamboo等)连接到MySQL服务器,你需要执行以下主要步骤:

  • 首先,确保你有一个为MySQL服务器主机生成的有效的SSL/TLS证书,并且CA证书安装在客户端主机上(如果你使用自签名,那么你可能需要手动执行此操作,但对于流行的公共CA,它已经在那里了)。
  • 接下来,确保java密钥库包含所有CA证书。在Debian/Ubuntu上,这是通过运行以下命令来实现的:
update-ca-certificates -f
chmod 644 /etc/ssl/certs/java/cacerts
  • 最后,更新Atlassian产品使用的连接字符串以包含所有必需的选项,这在Debian/Ubuntu上类似于:
jdbc:mysql://mysql_server/confluence?useSSL=true&sslMode=VERIFY_IDENTITY&trustCertificateKeyStoreUrl=file%3A%2Fetc%2Fssl%2Fcerts%2Fjava%2Fcacerts&trustCertificateKeyStorePassword=changeit&enabledTLSProtocols=TLSv1.2&useUnicode=true&characterEncoding=utf8

更多相关信息请参见MySQL官方文档https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-using-ssl.html

参考

https://beansandanicechianti.blogspot.com/2019/11/mysql-ssl-configuration.html

CentOS7 yum安装MySql报错The GPG keys listed for the MySQL 8.0 Community Server repository are already installed but they are not correct for this package.的解决方法

在CentOS7中使用yum安装MySql8的时候,遇到这个问题。

原因是,MySQL GPG密钥已过期,无法从官方存储库安装或升级MySQL包。其他详细信息也可以在MySQL网站上找到:https://bugs.mysql.com/bug.php?id=106188

解决方法是,在运行安装程序之前导入密钥:

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

对于Ubuntu系统:

wget -q -O - https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 | apt-key add -

参考

https://support.cpanel.net/hc/en-us/articles/4419382481815

https://forums.cpanel.net/threads/mysql-upgrade-process-failed-the-gpg-keys-listed-for-the-mysql-8-0-community-server-repository-are-already-installed-but-they-are-not-correct-for.697213/

Navicat出现Access violation at address 00000000. Read of address 00000000问题的解决方法

我的操作系统是Winodws 10,在使用Navicat Premium 16的模型或图表工作区时,弹出一个错误对话框说Access violation at address 00000000. Read of address 00000000。

出现这个问题的原因,应该是Winodws 10操作系统里安装的C++运行库与Navicat Premium 16所要求的版本不一致。Navicat Premium 16在Winodws 7操作系统里并不会出现这个问题。

因此这个问题的解决方法可以是,先在Winodws 10操作系统里安装VirtualBox,再安装Winodws 7虚拟机,然后在该虚拟机里安装和使用Navicat Premium 16。

PowerBuilder和SQL Anywhere安装位数版本不一致会导致的问题

由于PowerBuilder 12.5是一个32位应用程序,因此SQL Anywhere也需要安装32位版本。如果二者位数不一致,那么PowerBuilder将无法创建SQL Anywhere数据库,报错“ODBC驱动管理器 连接未打开”,并且PowerBuilder通过SQL Anywhere ODBC连接到数据源时,会出现错误:SQLSTATE = IM003由于系统错误193,无法加载指定的驱动程序:(SQL Anywhere 12,C:\Programs\SQL Anywhere 12\Bin64\dbodbc12.dll)。

参考

https://codejzy.com/posts-1134504.html

https://blog.csdn.net/gc_2299/article/details/88832289

Kernel Panic – not syncing VFS Unable to mount root fs on unknown-block(0,0)问题的解决方法

VirtualBox启动CentOS 7虚拟系统时,遇到Kernel Panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)问题,无法启动系统。

引起该问题的原因是缺少该内核的初始化文件。

解决方法是从启动界面的GRUB菜单中选择另一个内核来启动系统。进入系统后运行sudo update-initramfs -u -k version为version生成初始化文件(将version替换为内核版本字符串,例如4.15.0-36-generic),然后运行sudo update-grub更新GRUB。

参考

https://askubuntu.com/questions/41930/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block0-0

VS Code连接远程服务器时弹出an ssh installation couldn’t be found对话框的解决方法

我的操作系统是Windows 10。

在VS Code中安装Remote-SSH扩展进行远程开发,首次连接远程服务器时出现an ssh installation couldn’t be found对话框,该错误表明VS Code Remote-SSH扩展在Windows系统中找不到ssh.exe。

VS Code默认将在PATH环境变量中查找ssh命令,如果找不到,就会出现上述错误。

可以先在Windows系统中安装Git软件包,它会同时安装ssh.exe,然后在VS Code Remote-SSH扩展的设置里,将remote.SSH.path配置项的值设置为ssh.exe在Windows系统里的绝对路径,明确告诉VS Code SSH客户端的位置,具体步骤为:

在VS Code中按下F1键 -> 输入Remote-SSH:Settings后回车,打开Remote-SSH的配置文件 -> 找到remote.SSH.path配置项,填入ssh.exe在Windows系统中的绝对路径,例如:C:\Programs\Git\usr\bin\ssh.exe

除了使用Git软件包包含的ssh.exe外,也可以安装OpenSSH软件包,使用它包含的ssh.exe。