• Resolved neotechnomad

    (@neotechnomad)


    Constantly getting this error…

    PHP Warning:  mysqli_query(): Error reading result set's header in /home/*********/public_html/wp-includes/wp-db.php on line 2030
    PHP Warning:  mysqli_query(): MySQL server has gone away in /home/*********/public_html/wp-includes/wp-db.php on line 2030

    …suggestions to solve?

Viewing 6 replies - 1 through 6 (of 6 total)
  • @neotechnomad

    Two most common reasons (and fixes) for the MySQL server has gone away (error 2006) are:

    Server timed out and closed the connection. How to fix:

    check that wait_timeout variable in your mysqld’s my.cnf configuration file is large enough. On Debian: sudo nano
    /etc/mysql/my.cnf, set wait_timeout = 600 seconds (you can tweak/decrease this value when error 2006 is gone), then sudo
    /etc/init.d/mysql restart. I didn’t check, but the default value for wait_timeout might be around 28800 seconds (8 hours).

    Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf file. On Debian: sudo nano
    /etc/mysql/my.cnf, set max_allowed_packet = 64M (you can tweak/decrease this value when error 2006 is gone), then sudo
    /etc/init.d/mysql restart.

    if you can’t run commands then you can simply edit these files. (my.cnf or my.ini) with proper values.

    Thread Starter neotechnomad

    (@neotechnomad)

    Thanks for the swift reply.
    I have root access – Hosted VPS, Centos 7.7, cPanel ver.86.0.12 – so I will give these a try, but are the directory paths and cmds different on Centos than Debian?

    Thread Starter neotechnomad

    (@neotechnomad)

    @jraborar
    I increased the max_allowed_packet to 1073741824.
    I will wait and see if this solves the issue.
    Thanks again. ??

    Moderator Yui

    (@fierevere)

    永子

    You can find some more info in mysql error log, why server has gone away,
    generally this error happens when here is something really weird with the server. Like: memory exhausted, max_allowed_packet is too small, corrupted tables and/or filesystem, more bad things.

    By default in CentOS, your error log must be in /var/lib/mysql/hostname. err (replace hostname by the real hostname of your server)

    Please check bottom of error log file

    I increased the max_allowed_packet to 1073741824.

    enormous values are not recommended.
    For typical WP+WooCommerce installs 16M is enough, 32M-64M is near the maximum expectation.

    • This reply was modified 4 years, 8 months ago by Yui.
    Thread Starter neotechnomad

    (@neotechnomad)

    @fierevere
    Thanks for the advice.

    Original max_allowed_packet was 268435456 before I changed it to 1073741824.
    I have now changed max_allowed_packet to 67108864.
    Will keep an eye on error log and advise.

    Thread Starter neotechnomad

    (@neotechnomad)

    Decreasing the max_allowed_packet to 67108864 seems to have fixed it.
    Thanks for all your assistance. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Errors in wp-db.php’ is closed to new replies.