Home >Database >Mysql Tutorial >How Can I Correct Timezone Discrepancies Between UTC and GMT 1 in MySQL?
Correcting Timezone Discrepancy: Transitioning UTC to GMT 1
Encountering a timezone discrepancy between UTC and GMT 1 can be resolved with ease using MySQL commands. Here's the solution:
Setting the Global Timezone
To adjust the global timezone, you can use the following command in phpMyAdmin's SQL execution section:
SET GLOBAL time_zone = 'Europe/London';
Ensure to replace 'Europe/London' with the desired GMT 1 timezone value.
Handling Daylights Savings Adjustments
The named timezone is crucial for timezones that undergo daylights savings adjustments. Consider the command:
SET GLOBAL time_zone = 'America/New_York';
This sets the global timezone to America's Eastern Time Zone, which factors in daylights savings.
Resolving "Unknown or Incorrect Time Zone" Error
For certain Linux builds, you may encounter the error "#1298 - Unknown or incorrect time zone." To address this:
mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql -p
This will import all definitions from your zoneinfo into MySQL.
The above is the detailed content of How Can I Correct Timezone Discrepancies Between UTC and GMT 1 in MySQL?. For more information, please follow other related articles on the PHP Chinese website!