Home > Database > Mysql Tutorial > How Can I Correct Timezone Discrepancies Between UTC and GMT 1 in MySQL?

How Can I Correct Timezone Discrepancies Between UTC and GMT 1 in MySQL?

Patricia Arquette
Release: 2024-12-03 15:31:12
Original
777 people have browsed it

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';
Copy after login

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';
Copy after login

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:

  1. From the Linux command line, execute:
mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql -p
Copy after login
  1. Provide the root password for MySQL and run the command.

This will import all definitions from your zoneinfo into MySQL.

  1. Re-run the SET GLOBAL time_zone command to establish the desired timezone.

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template