返回顶部
首页 > 资讯 > 数据库 >解决mysql中group_concat长度限制的方案
  • 523
分享到

解决mysql中group_concat长度限制的方案

mysql数据库 2023-08-17 22:08:13 523人浏览 泡泡鱼
摘要

解决Mysql中group_concat长度限制的方案 group_concat函数获得group_concat的最大长度两种解决方案 group_concat函数 在mysql中的group_concat函数默认支持的最大

group_concat函数

mysql中的group_concat函数默认支持的最大字符数为1024。
当你使用group_concat函数时,超出第1024字符的字符会全部丢失。

show variables like 'group_concat_max_len';

在这里插入图片描述

今天就被这个问题搞了一两个小时。不使用group by和group_concat时数据是正确的。
一用就发现使用了group_concat函数的列少了一些数据。

获得group_concat的最大长度

SELECT @@global.group_concat_max_len;或者show variables like "group_concat_max_len";

一看自己的mysql中group_concat的最大限制 发现等于1024

两种解决方案

使用sql设置group_concat的最大长度

SET GLOBAL group_concat_max_len=4294967295; SET SESSioN group_concat_max_len=4294967295; 

在MySQL配置文件中my.conf或my.ini中添加:

#[mysqld]group_concat_max_len=4294967295

然后重启mysql服务

service mysqld restart或者systemctl restart mysqld.service

再次点击查看就发现已经修改了
在这里插入图片描述

来源地址:https://blog.csdn.net/guo_qiangqiang/article/details/126528901

您可能感兴趣的文档:

--结束END--

本文标题: 解决mysql中group_concat长度限制的方案

本文链接: https://www.lsjlt.com/news/373367.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作