mysql allow invalid dates on select

后端 未结 2 2056
陌清茗
陌清茗 2021-02-14 22:53

For some reason, I can\'t even select invalid dates in my table. How do I force select? I just receive:

select * from table
>> Mysql2::Error: Invalid date:         


        
2条回答
  •  我在风中等你
    2021-02-14 23:44

    • Log into mysql in the command line mysql -u root -p
    • Enter your password
    • View the current sql-modes using SELECT @@GLOBAL.sql_mode;
    • Copy the current modes (add or delete modes as needed) and paste in next step.
    • Set the sql-modes using SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES';
    • This adds ALLOW_INVALID_DATES and removes both NO_ZERO_DATE, NO_ZERO_IN_DATE
    • Restart the MySQL server /etc/init.d/mysql start

提交回复
热议问题