Search code examples
phpmysqllaravelgroup-concat

Issue with group_concat() in Laravel 5


I am using group_concat() in my Laravel 5 model's Query. In this regard I use this statement.

DB::statement('SET GLOBAL group_concat_max_len = 1000000');

It is working fine in Locally but it not working in Live online server.

Could anyone say where is the problem ??


Solution

  • A few further questions/answers may help us help you:

    • Does your hosting provider enable modification of global variables?
    • Does your user permissions have the "SET" privilege?
    • Is the query throwing an error of any kind in your non-local environment?

    A better check would be to see if the transaction has processed successfully using a sub-sequent check request on the database, because if you have set it globally it should work for all sessions, even ones not executed by your code.

    SHOW VARIABLES LIKE 'group%';
    

    Should indicate the current group concat max length configured.

    Goodluck.