5

Introduction

Recently I was getting this error: WordPress database error: [Got a packet bigger than 'max_allowed_packet' bytes] every time I was making a new post, editing an existing post, making a new page, or editing an existing page. I was hoping nothing was messed with my WordPress database, fortunately this message doesn’t mean anything is wrong with the database.

How Do I Fix It?

The answer to this question depends. If you have a virtual private server (VPS) or root access to MySQL, it’s an easy 5 minute fix. If you don’t have a VPS, don’t know how to do it, or don’t have root access, you’re web host will have to fix it for you.

For those who do have access, here’s what you do:

  1. Login as root. This is what I have:
    root@vps [~]#
  2. Because that is the wrong directory, I do a change directory command:
    root@vps [~]# cd ..
  3. That will then give me:
    root@vps [/]#
  4. My etc directory is there, so I:
    root@vps [/]# cd etc
  5. Pull out the trusty vi editor:
    root@vps [/]# vi my.cnf
  6. You may not exactly have the same information as I have in my my.cnf file, but the principle is the same:
    [mysqld] 
    
    set-variable = max_connections=500 
    
    safe-show-database 
    
    set-variable = key_buffer_size=3M 
    
    set-variable = table_cache=132 
    
    set-variable = read_buffer_size=2M 
    
    set-variable = join_buffer_size=2M 
    
    set-variable = sort_buffer_size=2me: vps.bui4ever.com2007 
    
    set-variable = read_rnd_buffer_size=2M 
    
    set-variable = query_cache_size=64M 
    
    set-variable = query_cache_limit=4Mold-passwords = 1
  7. Between [mysqld] and set-variable = max_connections=500, add:
    max_allowed_packet=16M

In many cases, that will resolve the issue. Worse case scenario, you’ll have to increase it to as high as 32MB. It’s not a good idea to set it to high as it will utilize more server resources and also cause other errors. For more reading, go to MySQL Reference Manual B.1.2.9 Packet too large.

Popularity: 13% [?]

If you liked this post then consider subscribing to our full feed RSS. You could also subscribe to our email feed and have new posts sent directly to your inbox.

Continue readingPrevious » « Next

Comments

  1. Thank you
    Great help

  2. any idea how to change this value in MAMP? I can’t find the my.conf file anywhere!

    Add rating 0  Subtract rating 0  
  3. I use MAMP, but I’m not 100% sure where to find it. Have you tried adding this to your .htaccess file to see if it works:

    php_value memory_limit 32M

  4. edit /Applications/mamp/bin/startMysql.sh and add:
    –max_allowed_packet=32M

  5. Kev: Thanks for the info! I’m sure many people will find this very useful to know.

Leave a Comment






XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>