mysql - 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
解决方案
推荐阅读
- python - 如何对张量变量进行比较赋值?
- python - 同时将多列的类型从日期时间更改为日期(熊猫)
- visual-studio - 如何写入 Visual Studio 输出窗口
- java - 我对 java.lang.Thread.run(Unknown Source) 有一个例外
- javascript - 无服务器部署因使用 require AND import 而失败
- python - 如何使用 Docker/Kubenertes 正确运行 Python?
- fft - 犰狳复矩阵上第 2 个暗淡的 1D fft
- python - 如何在某些选定列中选择至少有一个值的行?
- sql - 如何从同一张表中不存在的表中获取计数/记录?
- python - 适用于 Linux 的 Windows 子系统上的 Anaconda