I am using hibernate (Hibernate Maven 5.2.15.Final, Mysql-connector Maven 8.0.9-rc) whith mysql 5.7 on lampp environment on linux so.
I am in Italy (Central Europea
If the problem is when connecting to the db, I found the solution in the NOTE of this answer.
In your connection url use the following:
String url = "jdbc:mysql://localhost/mydb?serverTimezone=Europe/Rome";
This worked for me to connect with flyway and timezone Europe/Amsterdam.
@aiman's answer is not correct since in your case the effective server timezone is not UTC.
You'll find on the net some solutions including additional parameters on the jdbc connection string, but there are cases where you cannot change this string.
Here's how I fixed it:
First import the system timezones in mysql:
$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Then set your default mysql server timezone in the [mysqld]
section of /etc/mysql/my.cnf
(or of /etc/mysql/mysql.conf.d/mysqld.cnf
on recent Debian/Ubuntu distros) to your actual server timezone, for instance:
default_time_zone = Europe/Paris
and don't forget to restart mysql
$ sudo service mysql restart
(or the appropriate command depending on your distro).
First see your mysql server timezone:
mysql -e "SELECT @@global.time_zone;" -u <mysqluser> -p
.
Most probably it should be SYSTEM
.
Find your system timezone: date +”%Z
.
See if its CEST.
You need to change your system timezone:
#cd /usr/share/zoneinfo
#ls -l
#rm /etc/localtime
#ln -s /usr/share/zoneinfo/UTC /etc/localtime
Then restart your mysql server: /etc/init.d/mysqld restart
.
Enjoy