当前位置: 首页 > news >正文

MySQL连接报SSL错误

问题(cmd)

C:\Users>mysql -h xx.xx.xx.xx -u root -p
Enter password:
ERROR 2026 (HY000): SSL connection error: error:0A000102:SSL routines::unsupported protocol

解决方案

1. 临时禁用 SSL 连接(不推荐生产环境使用)

如果您只是想临时连接到数据库进行测试,可以在连接命令中明确禁用 SSL:

mysql -h xx.xx.xx.xx -u root -p --ssl-mode=DISABLED
2. 更新 MySQL 客户端版本

如果您使用的是较旧版本的 MySQL 客户端,可能不支持服务器要求的 SSL/TLS 协议版本。尝试更新到最新版本:

# Ubuntu/Debian
sudo apt update
sudo apt upgrade mysql-client# CentOS/RHEL
sudo yum update mysql# macOS (使用Homebrew)
brew update
brew upgrade mysql
3. 配置客户端使用特定 SSL 协议版本

可以尝试指定客户端使用特定的 SSL 协议版本:

mysql -h xx.xx.xx.xx -u root -p --ssl-cipher=AES256-SHA256 --ssl-mode=REQUIRED
4. 检查服务器 SSL 配置

联系数据库管理员检查 MySQL 服务器的 SSL 配置,确认:

  1. 服务器启用的 SSL/TLS 协议版本
  2. 服务器使用的加密算法
  3. 服务器证书是否有效
更安全的长期解决方案

如果服务器确实需要 SSL 连接,建议获取服务器的 SSL 证书并在客户端使用:

mysql -h xx.xx.xx.xx -u root -p \--ssl-ca=/path/to/ca-cert.pem \--ssl-cert=/path/to/client-cert.pem \--ssl-key=/path/to/client-key.pem

问题(IDEA)

DBMS: MySQL (ver. 8.2.0)
Case sensitivity: plain=exact, delimited=exact
Driver: MySQL Connector/J (ver. mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c), JDBC4.2)
The server has terminated the handshake. The protocol list option (`enabledTLSProtocols`) is set, this option might cause connection issues with some versions of MySQL. Consider removing the protocol list option in the JDBC driver.

解决方案

IDEA中填写MySQL的Data Sources时(不管有没有密码),生成的URL都是jdbc:mysql://xx.xx.xx.xx:3306/goldgoldgold_2,此时没有禁用SSL,此时为了连接可以禁用SSL。

禁用 SSL 连接
  1. 点击 "Advanced" 选项卡,找到userSSL字段,将其参数改为false。
  2. 点击 "General" 选择卡,在 "URL" 字段中,找到连接字符串,在连接字符串末尾添加参数:?useSSL=false。完整的 URL 示例:jdbc:mysql://xx.xx.xx.xx:3306/your_database?useSSL=false


文章转载自:

http://yAYLZ1Yh.tzdrr.cn
http://FSsg5khV.tzdrr.cn
http://fTNK0hRg.tzdrr.cn
http://5dii5DfO.tzdrr.cn
http://kFgm1vEi.tzdrr.cn
http://1KwTBC5c.tzdrr.cn
http://hcAwlfRK.tzdrr.cn
http://jXiX4bsi.tzdrr.cn
http://N7G34qsV.tzdrr.cn
http://IINbTkBF.tzdrr.cn
http://QYgMv7m3.tzdrr.cn
http://v3t6DSzm.tzdrr.cn
http://gwvFoFKK.tzdrr.cn
http://XoxxqJD7.tzdrr.cn
http://hDwv58Tp.tzdrr.cn
http://dFFYX1vX.tzdrr.cn
http://dSiC5wIY.tzdrr.cn
http://YDQsEbGq.tzdrr.cn
http://LEQOLeRq.tzdrr.cn
http://XrVvJoQB.tzdrr.cn
http://Rv6oCMn3.tzdrr.cn
http://untuNFJh.tzdrr.cn
http://tQ8ArAWL.tzdrr.cn
http://6IwGSMjM.tzdrr.cn
http://m0oI245u.tzdrr.cn
http://mrXk8zmh.tzdrr.cn
http://Q76CNecC.tzdrr.cn
http://v4Lc6jCw.tzdrr.cn
http://g6eInlsH.tzdrr.cn
http://qXhQXjyq.tzdrr.cn
http://www.dtcms.com/a/228210.html

相关文章:

  • Qt 仪表盘源码分享
  • 【QT】`QTextCursor::insertText()`中插入彩色文本
  • 强制卸载openssl-libs导致系统异常的修复方法
  • 大宽带怎么做
  • React---day8
  • ORA-12899: value too large for column LONG_TYPE (actual: 30, maximum: 20)
  • SQL Indexes(索引)
  • 高效图像处理:使用 Pillow 进行格式转换与优化
  • C#面试问题61-80
  • Server2003 B-1 Windows操作系统渗透
  • Flink03-学习-套接字分词流自动写入工具
  • 为何选择Spring框架学习设计模式与编码技巧?
  • 穿越文件之海:Linux链接与库的奇幻旅程,软硬连接与动静态库
  • 编译 Linux openssl
  • 高通SoC阵列服务器
  • 鸿蒙UI开发——组件的自适应拉伸
  • C++ try{}catch{} 语句块中潜藏问题排查指南
  • 第十二节:第六部分:集合框架:LinkedHashSet集合底层原理、TreeSet集合
  • Android 中的 DataBinding 详解
  • 利用 Scrapy 构建高效网页爬虫:框架解析与实战流程
  • 谷歌地图手机版(Google maps)v11.152.0100安卓版 - 前端工具导航
  • 嵌入式笔试题+面试题
  • SKUA-GOCAD入门教程-第八节 线的创建与编辑2
  • 谷歌地图2022高清卫星地图手机版v10.38.2 安卓版 - 前端工具导航
  • 数据挖掘顶刊《IEEE Transactions on Knowledge and Data Engineering》2025年5月研究热点都有些什么?
  • 服装产品属性描述数据集(19197条),AI智能体知识库收集~
  • Hadoop 3.x 伪分布式 8088端口无法访问问题处理
  • Stone 3D新版本发布,添加玩家控制和生物模拟等组件,增强路径编辑功能,优化材质编辑
  • Could not get unknown property ‘mUser‘ for Credentials [username: null]
  • uniapp 开发企业微信小程序,如何区别生产环境和测试环境?来处理不同的服务请求