关于MySQL执行创建表命令后出现1055错误的解决方法
问题描述
如下例子:
CREATE TABLE t(
`deptno` INT(4),
`dname` VARCHAR(255),
`loc` varchar(255)
);
当执行这段代码时,navicat执行成功但是会报出1055错误,如下图所示
错误信息如下:
[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
解决办法
在建表命令后输入这段代码,执行一下,以后再执行就不会出现1055错误了
select version(),
@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
执行后的效果
参考https://blog.csdn.net/m0_45161766/article/details/111272644