MySQL truncates concatenated result of a GROUP_CONCAT function

As I already wrote in an earlier comment, the MySQL manual says:

Values in VARCHAR columns are variable-length strings. The length can
be specified as a value from 0 to 65,535.

So the problem is not with the data type of the field.

The MySQL manual also says:

The result is truncated to the maximum length that is given by the
group_concat_max_len system variable, which has a default value of
1024. The value can be set higher, although the effective maximum length of the return value is constrained by the value of
max_allowed_packet. The syntax to change the value of
group_concat_max_len at runtime is as follows, where val is an
unsigned integer:
SET [GLOBAL | SESSION] group_concat_max_len = val;

Your options for changing the value of group_concat_max_len are:

  1. changing the value at MySQL startup by appending this to the command:
    --group_concat_max_len=your_value_here
  2. adding this line in your MySQL configuration file (mysql.ini): group_concat_max_len=your_value_here
  3. running this command after MySQL startup:
    SET GLOBAL group_concat_max_len=your_value_here;
  4. running this command after opening a MySQL connection:
    SET SESSION group_concat_max_len=your_value_here;

Documentation: SET, Server System Variables: group_concat_max_len

Leave a Comment