红联Linux门户
Linux帮助

ubuntu16.04 mysql sql_mode=only_full_group_by问题

发布时间:2016-09-05 09:23:43来源:linux网站作者:抢地主
在创建表的时候,会提示1055错误:
[SQL]CREATE TABLE `m_part` (
`f_id` INT NOT NULL,
`f_name` VARCHAR (20)  NULL,
PRIMARY KEY (`f_id`)
) ENGINE = myisam DEFAULT CHARSET = utf8 
PARTITION BY RANGE (f_id)(        
PARTITION p0  VALUES less THAN (10),
PARTITION p1  VALUES less THAN (20)
);
受影响的行: 0
时间: 0.007s
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
 
这是sql_mode设置的问题,修改下mysql的sql_mode配置就可以了。
 
mysql.cnf文件在/etc/mysql/mysql.conf.d目录下:
文件最后添加下面的设置即可:(具体设置什么,根据需求)
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
重启 mysql服务就可以了:
/etc/init.d/mysql restart
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23887.html