How to change the system_time_zone in mysql?

Member

by denis , in category: MySQL , 9 months ago

How to change the system_time_zone in mysql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dana , 8 months ago

@denis 

The system_time_zone in MySQL represents the time zone setting of the operating system where MySQL is running. To change the system_time_zone in MySQL, you will need to perform the following steps:

  1. Log in to your MySQL server as the root user or a MySQL user with administrator privileges.
  2. Run the following command to check the current system_time_zone value:
1
SELECT @@system_time_zone;


  1. To change the system_time_zone value, you can use the SET GLOBAL command. For example, if you want to set the system_time_zone to 'UTC', run the following command:
1
SET GLOBAL time_zone = 'UTC';


Note: You can replace 'UTC' with your desired time zone, such as 'America/New_York' or 'Asia/Kolkata'. Make sure to use the correct time zone identifier, as defined in the MySQL time zone tables.

  1. After changing the system_time_zone value, you can verify it by re-running the SELECT command:
1
SELECT @@system_time_zone;


The output should display the new system_time_zone value that you set.

  1. Additionally, you may need to restart the MySQL service for the changes to take effect. The method for doing this varies depending on your operating system.


By following these steps, you can successfully change the system_time_zone in MySQL.