1
votes

I am trying to set max_allowed_packet using php code but i get this error:

WordPress database error Access denied; you need the SUPER privilege for this operation for query SET GLOBAL max_allowed_packet=16777216 made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include('/themes/supreme/functions.php')

My PHP/Wordpress code is:

global $wpdb;
if ( $wpdb ) {
    $wpdb->query( "SET GLOBAL max_allowed_packet=16777216" );
}
1
Exactly how are you trying to set max_allowed_packet? Can we see your code? - MrWhite
My code is: global $wpdb; if ( $wpdb ) { $wpdb->query( "SET GLOBAL max_allowed_packet=16777216" ); } - Shaikh Aezaz
can any one help me please ? - Shaikh Aezaz
Does my answer not clear up what you need to do? Sorry. The issue is at the database. But if you are changing permission on the database, you might as well set the option in my.cnf rather than give your application super access. Let me know if you need more information. - nOw2

1 Answers

1
votes

Your SQL there is how you would do it directly from PHP. However this is not really an application level configuration.

The SQL is being disallowed by the database itself.

You need to talk to your database administrator:

  • Either to give you super access for your application (this seems unwise).
  • Or to increase the setting for the MySQL instance you are using, thus negating the need to do it from your application.