Search code examples
databaseclickhouse

Changing the time zone in all Clickhouse databases


The Linux server clock is based on Asia/Istanbul, but when a column is based on DateTime, it does not store the time based on Asia/Istanbul.
Based on the searches I had, it seems that the time zone can be specified during the creation of the table, but I plan to change the click house time zone to Asia/Istanbul in my settings.
How do I do this?

tip:
previously file /etc/clickhouse-server/users.xml I edited and added the defaults section and restarted Click House, but it got an error and didn't work.
<timezone>Asia/Istanbul</timezone>


**The problem was solved**
The problem was with DBeaver, DBeaver automatically changed the clock of the columns based on its settings, but when we display the columns from the CLI click house, the clock is set correctly and based on the local location.

Solution

  • it's a server setting (not users.xml)

    https://kb.altinity.com/altinity-kb-setup-and-maintenance/altinity-kb-server-config-files/

    cat /etc/clickhouse-server/config.d/timezone.xml
    <clickhouse>
      <timezone>Asia/Istanbul</timezone>
    </clickhouse>
    

    Also Clickhouse store data in UTC timezone internally.

    Timezone settings impact only text representation during insert and select.