Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

MySQL error 1160 – How to fix

by | Jul 6, 2021

Wondering how to fix Mysql Error 1160? We can help you!

Often our customers report to us that they get this error in their MySQL and connection to MySQL was lost.

Here at Bobcares, we often handle requests from our customers to fix similar errors as a part of our Server Management Service.

Today let’s see how our Support Engineers fix this issue for our customers.

How to fix MySQL Error 1160

Before going into the steps for fixing this error we will see what causes this error.

From the logs we will be able to see the following warning:

120611 16:12:30 [Warning] Aborted connection 2619503 to db: ‘db_name’ user: ‘user_name’ host: ‘webapp_hostname’ (Got an error reading communication packets)

This means that the connection to MySQL is actually aborted, and the site that uses the database will not be working most likely.

Generally, we see Joomla or other CMS-based websites affected by this issue.

Causes for this error:

Following are some of the causes for this error:

1. We may end up with this error if we send a query to the server that is incorrect or too large.

When mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection.

If we wish to use big queries (for example, if we are working with big BLOB columns), we can increase the query limit by changing the server’s max_allowed_packet. By default value of max_allowed_packet is 1MB.

Also, we may have to increase the maximum packet size on the client end. More information on setting the packet size is given in Section C.5.2.10, “Packet too large”.

2. An INSERT or REPLACE statement that inserts a great many rows can also cause these sorts of errors.

Either one of these statements sends a single request to the server irrespective of the number of rows to be inserted; thus, we can often avoid the error by reducing the number of rows sent per INSERT or REPLACE.

3.The most probable cause is MySQL’s query cache mechanism, so first, check if query cache is enabled:

mysql> show variables like '%query_cache%';
+------------------------------+---------+
| Variable_name | Value |
+------------------------------+---------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 0 |
| query_cache_strip_comments | OFF |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+---------+
7 rows in set (0.00 sec)

Note: The issue appears only if the nd_mysqli PHP extension enabled.

Steps to fix MySQL error 1160

We will see two methods with which we can fix this error.

Method 1:

1. We can try to increase the max_allowed_packet to a much larger number since the default is 1M.

2. This can be done about 10 times the largest TEXT or BLOB field we have in our current dataset.

3. For setting the max_allowed_packet to 256M, we can add it to /etc/my.cnf or my.ini

[mysqld]
max_allowed_packet=256M

3. Then save the file and exit.

4. After that we can run the following command:

SET GLOBAL max_allowed_packet = 1024 * 1024 * 256;

Method 2:

If we face the issue with Aborted connection messages (it applies to MySQL 5.7 only), we can try to disable query_cache first, or use mysqli PHP extension instead of nd_mysqli.

[Need assistance? We can help you]

Conclusion

To conclude, we saw the steps that our Support Techs follow to fix MySQL error 1160 for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF