【发布时间】:2022-01-31 19:36:41
【问题描述】:
从 java 应用程序通过身份验证代理连接到 Cloudsql DB 时,出现以下错误。
Caused by: java.sql.SQLException: SSL connection required for plugin "mysql_clear_password". Check if 'sslMode' is enabled.
无法通过 mysql 文档获取要设置的正确值。
有没有人遇到过类似的问题?
以下是参考代码:
String jdbcURL = String.format("jdbc:mysql://127.0.0.1:3306/%s", DB_NAME);
Properties connProps = new Properties();
connProps.setProperty("user", DB_USER);
connProps.setProperty("password", DB_PASSWORD);
connProps.setProperty("cloudSqlInstance", CONNECTION_NAME);
connProps.setProperty("authenticationPlugins ", "com.mysql.jdbc.authentication.MysqlClearPasswordPlugin");
HikariConfig config = new HikariConfig();
config.setJdbcUrl(jdbcURL);
【问题讨论】:
-
您不直接使用 Java 连接器是否有原因?它提供了代理的所有好处,但仍在进行中。见github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/…。
标签: mysql google-cloud-platform jdbc google-cloud-sql cloud-sql-proxy