mysql使用group_concat显示数据不完整解决!

2020-12-24  本文已影响0人  DragonersLi
select group_concat(uid)  from  user  where uid = 509 or pid like '%,509,%'
 #数据显示不完整
509,520,625,688,766,767,852,1069,1178,1200,1225,1293,1408,1433,1558,1575,1661,1663,1672,1677,1707,1740,1754,1756,1759,1761,1774,1785,1792,1804,1811,1826,1831,1859,1884,1976,2016,2020,2041,2130,2133,2149,2166,2174,2185,2188,2222,2229,2292,2357,2364,2385,2409,2520,2521,2531,2533,2536,2537,2538,2539,2543,2555,2580,2615,2773,2794,2800,2858,2889,2971,3161,3267,3390,3511,3520,3531,3584,3586,3587,3588,3591,3598,3600,3601,3607,3610,3617,3636,3639,3643,3644,3660,3671,3726,3767,3768,3781,3794,3806,3812,3824,3827,3838,3871,3881,3911,3915,3918,3923,3936,3942,3944,3970,3979,4046,4081,4110,4115,4124,4150,4166,4227,4228,4240,4248,4286,4538,4541,4663,4686,4709,4724,4729,4756,4768,4941,5081,5120,5335,5341,5343,5346,5352,5354,5375,5388,5415,5439,5452,5501,5511,5529,5540,5541,5545,5546,5567,5569,5570,5574,5626,5634,5636,5640,5649,5655,5661,5667,5673,5682,5700,5733,5737,5748,5756,5758,5774,5813,5819,5824,5828,5840,5948,5958,5987,6007,6008,6013,6025,6031,6036,6044,6055,6116,6153,6307,6748,6790,6811,6814,6830,6838,6842,6843,6846,6
重启服务后设置失效
//查看当前数据库的groupconcat长度
SHOW VARIABLES LIKE 'group_concat_max_len'; 

//执行以下语句修改成自己想要的长度
SET GLOBAL group_concat_max_len = 10240000;  
SET SESSION group_concat_max_len = 10240000;
在mysql配置文件里修改my.cnf长期有效

#找到group_concat_max_len 若填-1表示最大值,表示2^32 -1 = 4294967295
#若没有该项 直接添加即可 
group_concat_max_len = 10240000
阿里云数据库在参数设置里设置,输入范围:[4-1844674407370954752],输入-1并不能提交成功!
SHOW VARIABLES LIKE 'group_concat_max_len'; #修改完毕查询还是1024
SET SESSION group_concat_max_len = 10240000;#修改session中的值
阿里云数据库参数设置
上一篇 下一篇

猜你喜欢

热点阅读