sql_mode
> insert into tsm2(id, t1) values(6, '2024-03-32 00:00:00');
-- 非严格模式下,截断写入 t1 = 0000-00-00 00:00:00
-- 严格模式下,报错
-- Error Code: 1292. Incorrect datetime value: '2024-03-32 00:00:00' for column 't1' at row 1
> create table tsm4(id int primary key, c1 char(3), c2 varchar(3));
> insert into tsm4(id, c1, c2) values(7, '123456', '123456');
-- 非严格模式下,截断写入 c1 = 123 c2 = 123
-- 严格模式下,报错
-- Error Code: 1406. Data too long for column 'c1' at row 1
-- jdbc-mysql驱动默认会设置sql_mode为STRICT_TRANS_TABLES,所以即使mysql本身的sql_mode='', 超出长度也会报错, 如果要取消这一默认行为可以在连接参数上配置jdbcCompliantTruncation=false