Skip to content

Instantly share code, notes, and snippets.

@luizcarraro
Last active March 26, 2020 19:14
Show Gist options
  • Save luizcarraro/0e27fe12c2dd037bc3682de33490b59a to your computer and use it in GitHub Desktop.
Save luizcarraro/0e27fe12c2dd037bc3682de33490b59a to your computer and use it in GitHub Desktop.
Configurar MYSQL em UTC
1) Popule a tabela de timezones (sem esse passo nada funcionará)
$ mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root -p mysql
2) Edite o arquivo /etc/mysql/mysql.conf.d/mysqld.cnf
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
3) Adicione a seguinte linha abaixo de [mysqld]
default-time-zone='UTC'
4) Reinicie o serviço do Mysql
$ sudo service mysql restart
5) Teste:
- O resultado do comando SQL
SELECT @@global.time_zone;
Deve ser: UTC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment