How to get rid of STRICT SQL mode in MySQL

后端 未结 7 797
日久生厌
日久生厌 2020-12-15 04:59

This is a follow up to this question MYSQL incorrect DATETIME format

How to get rid of STRICT_TRANS_TABLES once and for all?

mysql --help report

7条回答
  •  余生分开走
    2020-12-15 05:24

    This problem scuppered me for a while as well. None of the answers so far addressed the original problem but I believe mine does so I'll post it in case it helps anyone else.

    I have MySQL (from mysql.com) Community Edition 5.7.10 installed on OS X 10.10.3

    In the end I created a /etc/mysql/my.cnf with the following contents:-

    [mysqld]
    
    sql_mode=NO_ENGINE_SUBSTITUTION
    

    After restarting the server a SHOW VARIABLES LIKE 'sql_mode'; gave me:-

    +---------------+------------------------+
    | Variable_name | Value                  |
    +---------------+------------------------+
    | sql_mode      | NO_ENGINE_SUBSTITUTION |
    +---------------+------------------------+
    1 row in set (0.00 sec)
    

    Finally, no strict mode!

提交回复
热议问题