如何在MySQL 8的JDBC连接字符串中设置SQL模式?

Fer*_*net 5 mysql connection-string jdbc mysql-8.0

我最近将我的MySQL实例从5.7升级到8.0.我使用JDBC和一个看起来像这样的连接字符串连接到我的旧实例:

jdbc:mysql://[host:port]/[database]/?sessionVariables=sql_mode=''
Run Code Online (Sandbox Code Playgroud)

升级到8.0后会导致此错误

com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '='')'.
Run Code Online (Sandbox Code Playgroud)

如何在MySQL 8的JDBC连接字符串中设置SQL模式?

Ant*_*aev 5

这似乎是 MySQL Connector/J 中的一个错误。我已经为其提出了错误报告:

https://bugs.mysql.com/bug.php?id=92485