error An unexpected error occurred: "https://registry.yarnpkg.com...connect ETIMEDOUT...
mysql查询出错误,only_full_group_by导致
1.问题出现的云因
在MySQL5.7.5后,默认开启了ONLY_FULL_GROUP_BY,所以导致了之前的一些SQL无法正常执行,其实,是我们的SQL不规范造成的,因为group by 之后,返回的一些数据是不确定的,所以才会出现这个错误。
2.报错如下
{"code":1,"data":{},"msg":"\n### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by\n### The error may exist in team/gk18software1dev/pcrsys/mapper/StudentMapper.java (best guess)\n### The error may involve team.gk18software1dev.pcrsys.mapper.StudentMapper.getListOnSelectByPcId-Inline\n### The error occurred while setting parameters\n### SQL: SELECT * from ( SELECT * from ( select student_choose_project.id,student_choose_project.stu_id, student_choose_project.pc_id,student_choose_project.p_id,student_choose_project.`status`, student.class_name,student.`name`,student.stu_number,student.telephone, student.station_name,student.wechat_num,student.email,student.remark from student_choose_project LEFT JOIN student on student_choose_project.stu_id=student.stu_id O
3.解决
关闭ONLY_FULL_GROUP_BY
方法一:
- 查看
select @@global.sql_mode;
- 设置
set @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
- 刷新
flush privileges;
方法二:
Linux的解决步骤:
①、登录进入MySQL,linux登录的:mysql -u username -p
,然后输入密码,输入SQL:show variables like '%sql_mode';
②、编辑my.cnf文件,文件地址一般在:/etc/my.cnf
,/etc/mysql/my.cnf
,找到sql-mode
的位置,去掉ONLY_FULL_GROUP_BY
,然后重启MySQL;有的my.cnf中没有sql-mode,需要加入:
sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,
注意要加入到[mysqld]下面,我就是加入到其他地方,重启后也不生效。
③、修改成功后重启MySQL服务,service mysql restart
,重启好后,再登录mysql,输入SQL:show variables like '%sql_mode';
如果没有ONLY_FULL_GROUP_BY,就说明已经成功了。
CentOS 使用yum命令安装出现错误提示:Loaded plugins: fastestmirror
yum install的时候提示:Loaded plugins: fastestmirror
fastestmirror是yum的一个加速插件,这里是插件提示信息是插件不能用了。
不能用就先别用呗,禁用掉,先yum了再说。
1.修改插件的配置文件
vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled = 1//由1改为0,禁用该插件
2.修改yum的配置文件
vi /etc/yum.conf
plugins=1//改为0,不使用插件
3 清除缓存并重新构建yum 源
yum clean all
yum clean dbcache
yum makecache
find: ‘/proc/1/map_files’: Permission denied
# 出现 find: '/proc/1/map_files': Permission denied
# 才用加 2>/dev/null,一般不用
find / -type d -name 文件名 2>/dev/null