【问题标题】:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.使用语句格式写入二进制日志的不安全语句,因为 BINLOG_FORMAT = STATEMENT。
【发布时间】:2023-03-16 19:27:01
【问题描述】:

尝试从 django 管理屏幕插入值时出现以下错误 -

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Request Method: POST
Request URL:    *<My URL>*
Django Version: 1.3.1
Exception Type: Warning
Exception Value:    
Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Exception Location: /Library/<Application>/2.7/site-packages/MySQLdb/cursors.py in _warning_check, line 92
Python Executable:  /usr/bin/python
Python Version: 2.7.1

我尝试在网上阅读,但无法正确解决该问题。有什么帮助吗?

【问题讨论】:

    标签: mysql django-admin


    【解决方案1】:

    想通了问题并解决了。这是因为并非所有表都是在同一个引擎下创建的(由于 mysql 5.5,新表在“InnoDB”下,而由于 mysql 5.0,旧表在“MyISAM”下)。

    这里是详细解释-http://generics7.blogspot.com/2012/08/unsafe-statement-written-to-binary-log.html

    在同一引擎下创建所有表后,它工作正常!

    【讨论】:

    • 如果平台不支持 InnoDB 怎么办?
    • 你能详细说明问题吗?如果它不支持 InnoDB,那么您的表将在 MyISAM 中,因此它应该可以正常工作。我错过了什么吗?
    • 发出这个命令对我有用:SET GLOBAL binlog_format = 'MIXED'; thx :)
    猜你喜欢
    • 2016-07-08
    • 2014-01-22
    • 2017-09-13
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 2011-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多