1

MysqlError: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

My query:

$sql = 'SELECT GROUP_CONCAT(field_one ORDER BY field_id SEPARATOR '-') AS field_ans FROM table_name';
  • field_one [am storing upto 450 characters].
  • Using GROUP_CONCAT, am trying to get multiple row values in a single column.

Note: Don't want to Run 'SET GLOBAL group_concat_max_len = 4096' in phpmyadmin. I want the change in PHP file.

am using group_concat in my query, so i increased group_concat_max_len value from 'default:1024 to 4096' for that query alone.

$sql = "SET GLOBAL group_concat_max_len = 4096";

How to get rid of the error, am getting the error in my log file??

Kaspar Mary
  • 126
  • 1
  • 11

1 Answers1

4

You're trying to change group_concat_max_len for the whole database (ie not just your query/session) and that requires database administrator privileges.

If you just want to change it for your session, instead use;

SET SESSION group_concat_max_len=15000;

...which will change it for your session only and does not require any elevated privileges.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294