开发者社区 > 云原生 > 中间件 > 正文

chaosblade-box,/QuerySceneFunctionByCategoryId接口报错

chaosblade-box,演练场景列表显示不出任何数据,都是提示“当前分类暂无场景,请重新选择”,
/chaos/QuerySceneFunctionByCategoryId接口报500错误,
报错信息:"\n### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'chaosblade.t_chaos_scene_authorized.authorized_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 com/alibaba/chaosblade/box/dao/mapper/SceneAuthorizedMapper.java (best guess)\n###
The error may involve defaultParameterMap\n### The error occurred while setting parameters\n### SQL:
SELECT authorized_id,function_id,function_name,function_code,grant_from,grant_to,permission,enabled,phase,source,function_create_time,support_host,support_k8s,is_public,
is_delete,id,gmt_create,gmt_modified FROM t_chaos_scene_authorized
WHERE function_id IN (?,?,?,?,?) AND ( enabled = ? ) AND (permission & 4) = 4 AND (phase & 2) > 0 AND support_k8s = ? AND is_delete = ? AND ( ( grant_to = ? AND is_public = ? ) OR
( is_public = ? ) ) GROUP BY function_id ORDER BY function_create_time DESC\n###
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and
contains nonaggregated column 'chaosblade.t_chaos_scene_authorized.authorized_id' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by\n; bad SQL grammar [];
nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'chaosblade.t_chaos_scene_authorized.authorized_id'
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"

展开
收起
游客usej4ekh5x7bi 2023-08-11 17:20:41 139 0
2 条回答
写回答
取消 提交回答
  • 参考:chaosblade-box github

    原因:

    运行ChaosBlade-Box请使用5.6及以下版本,5.7以上版本请设置全局变量

    解决:

    登录mysql,设置全局变量

    # 登录mysql
    sh-x.x# mysql -u username[登录mysql的用户名] -p password[登录mysql的密码]
    # 设置全局变量
    mysql> 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';
    

    新问题:

    设置后有可能会报错:ERROR 1231 (42000): Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'

    原因:

    是因为使用的mysql版本废弃了NO_AUTO_CREATE_USER

    解决:

    使用下面的命令即可:

    SET GLOBAL sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
    
    2024-05-15 16:39:02
    赞同 展开评论 打赏
  • 我没有使用过 chaosblade-box,所以不太清楚你的问题的具体原因。你可以尝试在 chaosblade-box 的官方论坛或者社区发布你的问题,或者在 chaosblade-box 的 GitHub 仓库中提交 issue。

    2023-09-26 10:44:54
    赞同 展开评论 打赏

为企业提供高效、稳定、易扩展的中间件产品。

热门讨论

热门文章

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载