MySQL 驱动依赖 Protobuf(Protocol Buffers)通常出现在需要高性能数据传输或特定功能支持的场景中。以下是详细原因分析及解决方案:
MySQL X Protocol 支持
性能优化
扩展功能依赖
caching_sha2_password
认证流程可能依赖 Protobuf 交换加密信息。驱动实现设计
mysql-connector-python
)用 Protobuf 抽象不同协议(如传统协议 + X Protocol)。java
// JDBC 示例:显式禁用 X Protocol
jdbc:mysql://host:3306/db?useXProtocol=false
xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
mysql-connector-java:5.1.48
)。properties
jdbc:mysql://host:3306/db?authenticationPlugins=mysql_native_password
ClassNotFoundException: com.google.protobuf.Message
xml
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.21.12</version>
</dependency>
连接云数据库失败
Unsupported protocol version
。java
jdbc:mysql://aurora-host:3306/db?useSSL=true&requireSSL=true
通过以上措施,可有效管理 Protobuf 依赖问题。