1

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" );
}
4
  • Exactly how are you trying to set max_allowed_packet? Can we see your code? Commented Jun 20, 2013 at 7:27
  • My code is: global $wpdb; if ( $wpdb ) { $wpdb->query( "SET GLOBAL max_allowed_packet=16777216" ); } Commented Jun 20, 2013 at 12:28
  • can any one help me please ? Commented Jun 22, 2013 at 5:47
  • 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. Commented Jun 26, 2013 at 10:49

1 Answer 1

1

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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.