ER_NET_PACKET_TOO_LARGE means one MySQL protocol packet exceeded the limit configured for the component handling it. That packet can be a SQL statement sent to the server, one row returned to a client, a mysqldump INSERT, or a binary-log event sent to a replica. MySQL then closes the connection, which is why applications sometimes show only “Lost connection to MySQL server during query.”
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
Fix the limit on every component involved: the server, the command-line client or dump utility, and—if replication is involved—the source and replica. First identify the largest statement, row, dump record, or replication event, then set a value above that size without choosing an unnecessarily large memory ceiling.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
What the max_allowed_packet error means
MySQL transfers data in communication packets. A packet is not limited to a network-sized fragment; it can represent one complete SQL statement, a single result row, or a replication event. If the client or mysqld receives a packet larger than its own max_allowed_packet value, MySQL raises ER_NET_PACKET_TOO_LARGE and closes the connection. Applications that do not expose the MySQL error may instead report “Lost connection to MySQL server during query.”
The limit is enforced independently by each side of a connection. Increasing only the server value does not enlarge a client buffer, and increasing a client option cannot make the server accept a larger packet.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Documented MySQL limits and defaults
| Component or limit | Documented value | What it means |
|---|---|---|
| Protocol maximum | 1GB | The largest possible packet supported by MySQL 8.0. |
Server (mysqld) default |
64MB | Default server-side packet ceiling documented in the MySQL 8.0 Reference Manual. |
mysql client default |
16MB | Default for the interactive command-line client. |
mysqldump default |
24MB | Default for the dump utility in the MySQL 8.4 Reference Manual. |
These are ceilings and defaults, not recommendations for every workload. A value should accommodate the largest legitimate statement, row, dump INSERT, or replication event that your workload creates.
Diagnose the failing component before changing anything
- Capture the exact error. Record whether the failure occurs during an application query, an import, an export, or replication. Note whether the message is
ER_NET_PACKET_TOO_LARGEor only “Lost connection to MySQL server during query.” - Estimate the packet that failed. Identify the largest SQL statement, BLOB or TEXT value, complete row, generated dump INSERT, or binary-log event involved. The setting must exceed that complete packet, not merely the size of one column you expect to be large.
- Inspect the server’s global value. Run:
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'; - Inspect the current session value. Run this in the same connection that performs the operation:
SHOW SESSION VARIABLES LIKE 'max_allowed_packet'; - Inspect the client or utility separately. The
mysqlclient andmysqldumpeach have their own packet setting. A server value that is high enough cannot compensate for a smaller client-side buffer. - Check both ends when replication is involved. The source and replica must be able to handle the messages exchanged between them, and a multithreaded replica also needs enough pending-job memory.
Do not start by setting the maximum to 1GB. Determine the real largest packet first, then leave practical headroom for protocol overhead and, for replication, event headers.
Choose a packet size without creating an avoidable memory risk
Set the value above the largest legitimate packet, with margin for overhead. MySQL allocates the extra packet memory when it is needed rather than reserving the entire maximum continuously, but an unnecessarily high ceiling can still permit large concurrent allocations when many sessions process large values at once.
- For a single large statement or row, size the limit above that statement or row.
- For imports, size it above the largest generated
INSERTstatement in the dump. - For row-based replication, size it for the complete row image and event overhead, not only the column that changed.
- Use the same or a larger value on every participating client and server.
Remember that the documented protocol maximum is 1GB. Values above that boundary are not valid, and a high value does not repair malformed SQL, insufficient disk space, or a server that is actually crashing for another reason.
Apply a temporary server fix
For an immediate test or a one-time import, change the global server value at runtime:
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
SET GLOBAL max_allowed_packet = 134217728;
134217728 is 128MiB expressed in bytes. Runtime SET syntax accepts a byte value or an arithmetic expression; it does not accept startup-style suffixes such as 128M. For example:
Free tools Windows power users keep installed
One-click scans. No signup required.
SET GLOBAL max_allowed_packet = 128 * 1024 * 1024;
SET GLOBAL changes the global value used for new connections under MySQL’s system-variable rules. Existing sessions can retain the session value they obtained earlier, so reconnect the application, client, or utility before retesting. Verify the result with:
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet';
A runtime change is lost when the server is restarted unless you also persist it.
Persist the server setting with SET PERSIST
On MySQL versions that support it, SET PERSIST changes the running value and writes a persistent setting:
SET PERSIST max_allowed_packet = 134217728;
Use the same byte-value rule shown above for runtime statements. After running it, confirm the global value and establish a fresh client connection for the operation that failed. If your installation or administrative policy does not use SET PERSIST, configure the server option file instead.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Persist the server setting in the option file
Add the setting under the [mysqld] group in the server option file:
[mysqld]
max_allowed_packet=128M
Startup configuration accepts the M suffix. The equivalent command-line startup form is:
mysqld --max_allowed_packet=128M
Restart the MySQL service, or use the installation’s documented reload procedure where supported. Then check the effective value with SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet';. Keep the configured value tied to a measured workload requirement; an arbitrary maximum can increase the amount of memory a busy server may allocate when multiple sessions send large packets.
Raise the interactive mysql client limit
The command-line mysql client has its own default of 16MB. Start it with a value at least as large as the server and the packet you need to send or receive:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →mysql --max_allowed_packet=128M -u USER -p DATABASE
For repeat use, place the option in the client option file:
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
[mysql]
max_allowed_packet=128M
The option-file and startup forms use the suffix notation. This setting controls the client’s communication buffer; it does not alter the server’s global variable. If an application uses a connector or driver rather than the mysql executable, configure that connector’s packet or buffer option according to its own documentation.
Fix mysqldump exports and imports
Exports that fail while mysqldump reads data
mysqldump has a separate --max-allowed-packet option. Its documented default is 24MB, and its documented maximum is 1GB:
mysqldump --max-allowed-packet=128M -u USER -p DATABASE > backup.sql
Use a value high enough for the largest row or value that the dump must retrieve. The option is specific to mysqldump; it is not the server’s max_allowed_packet variable.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchImports that fail while mysql executes the dump
An import involves both the dump file and the receiving client/server pair. Configure the receiving mysql client and ensure the server accepts at least the same packet size:
mysql --max_allowed_packet=128M -u USER -p DATABASE < backup.sql
The dump utility’s option cannot override a lower server limit. If the receiving server remains below the size of a generated INSERT, the import still fails even when the command that created the dump used a larger value.
Best Value
Why a dump can fail even when ordinary queries work
A dump may generate one large statement containing many values or a large BLOB/TEXT payload. The relevant packet is the complete generated statement, not the average row size. Compare the largest statement produced by the dump with the limits of mysqldump, the importing mysql client, and the destination server.
Replication-specific packet failures
Replication uses the same packet limit for messages between a source and replica. A large TEXT or BLOB value can stop the replication I/O thread if either side is configured too low.
Size for the largest row image
With row-based replication, an update event sends all columns and values for the affected row. A small changed column does not guarantee a small event when the row also contains large values. Size max_allowed_packet for the largest complete row image plus event overhead.
Check both source and replica
Raising the source alone is incomplete. Inspect and configure the packet limit on the source and the replica, then restart or reconnect the relevant replication components according to your topology. A lower limit on either side can still interrupt the I/O thread.
Configure pending-job memory on a multithreaded replica
For a multithreaded replica, set replica_pending_jobs_size_max to at least the source’s max_allowed_packet. The documented default discussed in the MySQL 8.4 replication guidance is 128MB. Event headers and row-based events can make an event larger than the nominal packet value, so allow additional room where the workload requires it.
After changing replication settings, monitor the I/O and applier threads and verify that the same large transaction can be received and applied. A packet-size fix does not resolve unrelated replication errors such as unavailable relay-log storage or SQL conflicts.
Recommended Free Tools
Common incomplete fixes and the correct replacement
| Incomplete action | Why it fails | Correct action |
|---|---|---|
| Raise only the server value | The client or utility may still have a smaller independent buffer. | Set compatible values on the server and the client or utility that sends or receives the packet. |
Run SET GLOBAL max_allowed_packet=128M |
Runtime SET does not use startup-style M suffixes. |
Use bytes, such as 134217728, or an arithmetic expression. |
Assume mysqldump --max-allowed-packet overrides the server |
The dump option controls only mysqldump and cannot exceed a lower server limit. |
Raise the receiving server as well as the dump or import client. |
| Raise the source only in replication | The replica or its I/O thread may reject the larger event. | Check both sides and size the multithreaded replica’s pending-job memory. |
| Set the maximum to 1GB without measuring | A very high ceiling can permit unnecessary large allocations under concurrency. | Measure the largest legitimate packet and add sensible protocol or event headroom. |
Understand scope, persistence and reconnect requirements
| Change method | Scope | Persists across restart | Connection behavior |
|---|---|---|---|
SET GLOBAL |
Server global value | No | Applies according to MySQL’s global-variable rules; new connections receive the changed global value. |
SET PERSIST |
Running server plus persistent configuration | Yes, where supported | Reconnect clients that retained an older session value. |
[mysqld] option file |
Server startup configuration | Yes | Requires restart or the installation’s supported reload procedure. |
mysql --max_allowed_packet |
One client invocation | No | Effective when that new client process starts. |
[mysql] option file |
Interactive client defaults | Yes for future client processes | Reconnect by starting a new client process. |
mysqldump --max-allowed-packet |
One dump process | No | Effective when that dump process starts. |
A practical end-to-end repair procedure
- Reproduce the failure and classify it as an application query, dump export, dump import, or replication event.
- Record the largest packet involved: complete statement, returned row, generated dump
INSERT, or replication row event. - Run both
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet';andSHOW SESSION VARIABLES LIKE 'max_allowed_packet';on the relevant server connection. - Inspect the command or configuration of the client,
mysqldump, connector, or replication peer handling that packet. - Choose a value above the measured packet, adding protocol overhead and, for replication, event-header margin.
- Apply a temporary byte value with
SET GLOBALto verify the diagnosis, or useSET PERSISTor the[mysqld]option file for a lasting server change. - Raise the matching client or utility option. Use
--max_allowed_packetformysqland--max-allowed-packetformysqldump. - Reconnect clients and restart processes that must read the new setting. For option-file changes, restart or reload the server according to the installation procedure.
- For replication, configure the source and replica, check
replica_pending_jobs_size_maxon multithreaded replicas, and retry the transaction or import. - After the operation succeeds, keep the smallest value that safely accommodates the workload and document why it was selected.
When increasing the limit does not solve the failure
If the same error appears after every involved component has a compatible value, verify that the value actually took effect in the process performing the work. A long-running application session can retain an older session setting, while a dump or client launched from a script may not be reading the option file you edited.
Then re-check the packet estimate. A row-based replication event can be larger than the changed field suggests, and a dump’s generated statement can be larger than an individual row. If the packet is below all configured limits, investigate other causes of a lost connection—such as a server restart, network interruption, query timeout, or resource failure—instead of continuing to increase max_allowed_packet.
Quick Recap
Key takeaways
ER_NET_PACKET_TOO_LARGEis a single-packet ceiling error; the packet may be a query, returned row, dump statement, or replication event.- Server,
mysql, andmysqldumplimits are separate and must be checked independently. - Use byte values with runtime
SET; reserve128M-style suffixes for startup or option-file syntax. SET GLOBALis a temporary runtime change,SET PERSISTwrites a persistent setting where supported, and[mysqld]configures startup.- Replication must be sized for the largest complete row or event, with adequate
replica_pending_jobs_size_maxon multithreaded replicas.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

