查看
#1、查看当前连接会话的sql模式:
mysql> select @@session.sql_mode;
或者从环境变量里取
mysql> show variables like "sql_mode";
#2、查看全局sql_mode设置:
mysql> select @@global.sql_mode;
只设置global,需要重新连接进来才会生效
复制代码
设置
设置
#形式如
mysql> set sql_mode='';
mysql> set global sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';
#如果是自定义的模式组合,可以像下面这样
Adding only one mode to sql_mode without removing existing ones:
mysql> SET sql_mode=(SELECT CONCAT(@@sql_mode,',<mode_to_add>'));
Removing only a specific mode from sql_mode without removing others:
mysql> SET sql_mode=(SELECT REPLACE(@@sql_mode,'<mode_to_remove>',''));
#配置文件里面设置 sql-mode=""