Django Mysql Database returned an invalid datetime value

John Doe ·

978 Views

Error

File "/home/kuba/.virtualenvs/VeeU/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in apply_converters
  779.                 value = converter(value, expression, self.connection, self.query.context)

File "/home/kuba/.virtualenvs/VeeU/lib/python3.5/site-packages/django/db/models/functions/datetime.py" in convert_value
  181.                         "Database returned an invalid datetime value. "

ValueError: Database returned an invalid datetime value. Are time zone definitions for your database installed?

 

Solution

1. Linux

contact@me:~$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
contact@me:~$ mysql -u root -p -e "flush tables;" mysql

2. Windows

1) Download posix timezone sql from https://dev.mysql.com/downloads/timezones.html
2) Do not move anything, just open this sql file in MySQL Workbench and add USE mysql; to the first line.
3) Run this file and that's it

 

* How to run SQL script in MySQL?

1. If you’re at the MySQL command line mysql> you have to declare the SQL file as source.

mysql> source \home\user\Desktop\test.sql;

2. CMD

 

Ref.

I have a Django app. I am using MySql server running in docker container as a database. After just moved to a custom User model. Now i am getting those errors: Environment: Request Method: GET Req...
i tried to TruncDay in django to turn date into day format , i use mysql version 8.0 with windows 10 this my settings.py TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True date = m...
■ SQL파일 실행 1. 프롬프트(cmd) 환경 예시) mysql -u(유저명) -p < sql파일명.sql mysql -uroot -p < testFile.sql 1) testFile.sql 내용 확인 2) 프롬프트(cmd)에서 실행 2. MySQL 접속 환경 예시) source sql파일명.sql source C:\MySQL\testFile.sql ■ SQL파일로 DataBase 백업 ※ 프롬프트(cmd) 환경 예시) mysqldump -u(유저명)

 

* MariaDB에서 root 암호 인증 방식이 먹히지 않는 이유(feat. unix_socket)

Skip to content 바깥 세상으로.. (As a kite by then) Search for: × Menu 첫머리 이곳은? 以前 記錄 記憶 (egloos) 주저리주저리 Prince & New Power Generation – Diamonds & Pearls 갑자기, Prince. Tears for Fears: The Tipping Point Pat Metheny: Road to the Sun 김태은/오경희/정민아 : 산조的 감각 Pat Meth

 

django SQL