> For the complete documentation index, see [llms.txt](https://olexsyn.gitbook.io/enote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://olexsyn.gitbook.io/enote/data/mysql/mysqldump/time-zone-utc.md).

# Time Zone UTC

Проблема: Дамп MySQL (MariaDB) видає час полів timestamp для TIME\_ZONE='+00:00'

Для прикладу, є така табличка:

```sql
CREATE TABLE `test` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(20) NOT NULL DEFAULT '',
  `dt` datetime NOT NULL DEFAULT '2000-01-01 10:00:00',
  `upd` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE
current_timestamp()
) ENGINE=MyISAM
```

Вносимо дані:

```sql
INSERT INTO test (name, dt) VALUES ('Peter',NOW());
INSERT INTO test (name, dt) VALUES ('Alex',NOW());
```

Перевіряємо:

```
select * from test;
| id | name  | dt                  | upd                 |
|  1 | Peter | 2023-04-14 11:36:42 | 2023-04-14 11:36:42 |
|  2 | Alex  | 2023-04-14 11:38:05 | 2023-04-14 11:38:05 |
```

Все ОК.

Робимо mysqldump, отримуємо:

```sql
-- MariaDB dump 10.19  Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
...
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
...
INSERT INTO `test` VALUES
(1,'Peter','2023-04-14 11:36:42','2023-04-14 08:36:42'),
(2,'Alex','2023-04-14 11:38:05','2023-04-14 08:38:05');

...
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
...

```

Час в полі timestamp - на 3 години менший. Це створює певні проблеми в роботі...

Виправляємо:

```
sudo nano /etc/mysql/conf.d/time_zone.cnf
```

(створюємо файл, якщо нема) і додаємо в нього:

```
[mysqldump]
tz-utc=false
```

Перевіряємо, зробивши новий дамп - все ОК. З дампу пропали рядки про time\_zone\
`/* ... TIME_ZONE= ... */;`,  а час колонок timestamp - той самий, що і записаний в базі.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://olexsyn.gitbook.io/enote/data/mysql/mysqldump/time-zone-utc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
