Trouble with timezone with hibernate and MySQL

The following URL produced the error: jdbc:mysql://localhost:3306/db?useLegacyDatetimeCode=false&serverTimezone=CET

This worked for me: replace & by &.


I've finally came across a solution. As it looked that neither ';' nor '&' would do the trick to add more than one parameter, I took out all the parameters, and tried only one parameter :

jdbc:mysql://localhost:3306/sakila?serverTimezone=UTC

And it did the trick, I no longer have problems with this.


You need to escape the &:

jdbc:mysql://localhost:3306/sakila?useSSL=false&serverTimezone=UTC

See more here: https://docs.jboss.org/exojcr/1.12.13-GA/developer/en-US/html/ch-db-configuration-hibernate.html