首页 > 解决方案 > flask 和 mysql 错误 (pymysql.err.InternalError) (1525, \"不正确的 DATETIME 值: '1399-02-30 '\")\n

问题描述

这部分后端代码在我的本地服务器上工作正常!

但不能在远程(主)服务器上工作!!!

我在主服务器中的后端错误:

{"status_code": 400, "description": "(pymysql.err.InternalError) (1525, \"Incorrect DATETIME value: '1399-02-30
'\")\n[SQL: SELECT count(*) AS count_1 \nFROM (SELECT discount.id AS discount_id, discount.user_id AS discount_user_id,
discount.s_time AS discount_s_time, discount.e_time AS discount_e_time, discount.code AS discount_code,
discount.percentage AS discount_percentage, discount.is_private AS discount_is_private \nFROM discount \nWHERE
discount.s_time < %(s_time_1)s AND discount.e_time>= %(e_time_1)s AND discount.code = %(code_1)s AND discount.user_id =
    %(user_id_1)s) AS anon_1]\n[parameters: {'s_time_1': '1399-02-30 ', 'e_time_1': '1399-02-30 ', 'code_1': 'v',
    'user_id_1': 81}]\n(Background on this error at: http://sqlalche.me/e/2j85)"}

本地服务器:

system_time_zone
Iran Daylight Time
time_zone
SYSTEM

主服务器

system_time_zone    430
time_zone   Asia/Tehran

本地服务器信息:

 Database server
 Server: MySQL (127.0.0.1 via TCP/IP)
 Server type: MySQL
 Server connection: SSL is not being used Documentation
 Server version: 5.7.28 - MySQL Community Server (GPL)
 Protocol version: 10
 User: root@localhost
 Server charset: cp1252 West European (latin1)
 Web server
 Apache/2.4.41 (Win32) PHP/7.4.0
 Database client version: libmysql - mysqlnd 7.4.0
 PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
 PHP version: 7.4.0

我的主要服务器信息:

数据库服务器

Server: ------ via TCP/IP
Server type: MySQL
Server connection: SSL is not being used Documentation
Server version: 8.0.20 - MySQL Community Server - GPL
Protocol version: 10
User: root@172.17.0.1
Server charset: UTF-8 Unicode (utf8mb4)

Web server

Apache/2.4.38 (Debian)
Database client version: libmysql - mysqlnd 7.4.4
PHP extension: mysqli Documentation curl Documentation mbstring Documentation
PHP version: 7.4.4

标签: mysqlflask

解决方案


推荐阅读