Home >Database >Mysql Tutorial >How to Change MySQL Timezone from UTC to GMT 1?

How to Change MySQL Timezone from UTC to GMT 1?

Linda Hamilton
Linda HamiltonOriginal
2024-11-30 08:41:10212browse

How to Change MySQL Timezone from UTC to GMT 1?

Changing MySQL Timezone

When your MySQL timezone is set to UTC, but you require it to be GMT 1, you need to execute the following command in phpMyAdmin SQL execution:

mysql> SET GLOBAL time_zone = 'GMT+1';

Note:

If you encounter an error stating "Unknown or incorrect timezone," you may need to run the following translation command:

mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql -p

Details:

  • Using the named timezone ('GMT 1' instead of ' 01:00') is crucial for timezones with daylight savings adjustments.
  • You must provide the MySQL root password for the mysql_tzinfo_to_sql translation to succeed.
  • After completing the translation, you can then execute the SET GLOBAL time_zone command.

By following these steps, you can effectively change your MySQL timezone to GMT 1 and ensure proper time formatting in your applications.

The above is the detailed content of How to Change MySQL Timezone from UTC to GMT 1?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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