question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MYSQL "timezone" connection option not working

See original GitHub issue

Issue type:

[ ] question [X] bug report [ ] feature request [] documentation issue

Database system/driver: MySql 2

[ ] cordova [ ] mongodb [ ] mssql [X] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version: 0.2.24 [X] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem: Hi everyone,

The timezone option in the connection options doesn’t seem to be taking any effect. In the docs, it says that it’s supported inside mysql / mariadb. I’ve tried using ‘Z’, ‘local’ and ‘+00:00’ as values, as suggested by the docs, but i didn’t notice any change. The timezone of the mysql server remained the same (local, AKA system_time_zone I believe).

As a workaround, right now, i’m using the following query on startup:

await connection.manager.query(
      'SET @@global.time_zone = \'+00:00\', @@session.time_zone = \'+00:00\';',
    );

Thanks,

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
DJEDAINIcommented, Mar 22, 2022

add this to connection configutation option:

timezone: ‘+8’

it should works then

0reactions
aixiamomocommented, Oct 13, 2022

timezone: ‘+8:00’

it should works then

Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL 8.0 Reference Manual :: B.3.3.7 Time Zone Problems
If you have a problem with SELECT NOW() returning values in UTC and not your local time, you have to tell the server...
Read more >
timezone - How do I set the time zone of MySQL?
To get a UTC datetime column as a UNIX timestamp ; 17. SELECT @@session.time_zone;. – James Skidmore ; 1. @the_nuts yes, the SET...
Read more >
How to Change Time Zone on MySQL Server {2 Easy Ways}
Option 1: Use the SET GLOBAL time_zone Command ... Instead of -6:00 , enter the GMT value you desire. If executed correctly, there...
Read more >
MySQL Time Zone Support (with examples) - mortensi
Discover current time zone · Change time zone · List available time zones · Select a timestamp column in UTC format · Select...
Read more >
Setting the MySQL timezone per connection
There may be instances when you need to set your MySQL database to a different timezone from the one the server is in,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found