mysql group concat函式的長度問題

2022-01-21 17:03:21 字數 910 閱讀 4519

網上搜了下 group_concat 資料截斷的問題,答案都指向了 group_concat_max_len 這個引數,它的預設值正好是1024。可以直接在資料庫中通過下面的命令檢視這個預設值:

mysql> show variables like

'group_concat_max_len';

+----------------------+-------+

| variable_name | value |+--

--------------------+-------+

| group_concat_max_len |

1024|+

----------------------+-------+

1 row in

set (0.00

sec)

mysql

>

所以解決辦法只要調整 group_concat_max_len 最大值就行了。

--

【必須操作】更改全域性配置----

set global group_concat_max_len=

1024000;--

【可選操作】使配置在當前會話中也立即生效,其它已經登入的會話終端需要重啟生效----

set session group_concat_max_len=

1024000;

或者:在c:\programdata\mysql\mysql server 5.7\my.ini

檔案追加

max_allowed_packet=20m

group_concat_max_len = 102400000

show variables like "group_concat_max_len"; 

重啟mysql服務

mysql GROUP CONCAT長度限制

在mysql中,有個函式叫 group concat 平常使用可能發現不了問題,在處理大資料的時候,會發現內容被擷取了,其實mysql內部對這個是有設定的,預設不設定的長度是1024,如果我們需要更大,就需要手工去修改配置檔案。解決辦法 group concat將某一字段的值按指定的字元進行累加,系...

MySQL GROUP CONCAT 長度限制

在mysql中,有個函式叫 group concat 平常使用可能發現不了問題,在處理大資料的時候,會發現內容被擷取了,其實mysql內部對這個是有設定的,預設不設定的長度是1024 在mysql配置檔案中加上 1 group concat max len 102400 你要的最大長度 2 可以簡單...

Mysql group concat字元長度限制

語句如下 select a id as id a category name as category name concat group concat separator as drug data from drug category a left join drug b on a id b cat...