iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
On an Ubuntu installation, the durable way to change MySQL’s connection ceiling is to edit /etc/mysql/mysql.conf.d/mysqld.cnf in the [mysqld] section, set max_connections, and restart mysql.service. If you need an immediate change, use SET GLOBAL; if you want MySQL to persist the SQL change itself, use SET PERSIST. Choose the number from measured concurrency and the server’s memory and file-descriptor capacity, not from a copied value on another host.
What max_connections controls
max_connections is a global, dynamic integer variable. It limits how many client sessions the MySQL server will accept at the same time. A client session can be an application connection, a command-line client, a monitoring agent, a migration job, or an idle connection held by a pool. The setting is a ceiling, not a target: raising it does not create connections, make queries faster, or fix a pool that opens connections unnecessarily.
When the limit is reached, MySQL refuses additional connection attempts and increments Connection_errors_max_connections. Existing sessions continue to run, so a saturated server may appear partly healthy while new requests fail. The right response can be a higher ceiling, a smaller or better-behaved pool, shorter idle lifetimes, or query and workload changes. Measure first so that the change addresses demand rather than hiding it.
Choose a safe value before changing anything
Measure the current peak
Connect to MySQL and collect the effective limit, current connected sessions, actively running sessions, and rejected connections:
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
SHOW GLOBAL VARIABLES LIKE 'max_connections';
SHOW GLOBAL STATUS LIKE 'Threads_connected';
SHOW GLOBAL STATUS LIKE 'Threads_running';
SHOW GLOBAL STATUS LIKE 'Connection_errors_max_connections';
Threads_connected is the number of open client sessions at the instant of the query. Threads_running shows sessions currently executing work, which is usually lower when many pooled connections are idle. Repeat these checks during the busiest period or use your existing monitoring history; a quiet snapshot can miss a short connection spike. A rising rejected-connection counter confirms that the limit has been hit at some point, but it does not by itself prove that simply increasing the limit is the best fix.
Account for connection cost
Every additional session can consume memory for thread state, buffers, authentication, temporary work, and the workload’s own operations. The practical limit therefore depends on available RAM, memory used per connection, query behavior, the response time you require, and available file descriptors. A high ceiling that the host cannot serve safely can turn a connection spike into swapping, slow queries, or an out-of-memory failure.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesConnection pools also matter. For example, several application workers may each maintain a pool whose maximum is larger than the application’s real concurrency. Add the possible pool totals, administrative clients, scheduled jobs, and replication or monitoring connections before selecting a value. Do not copy a large number from an unrelated server: hardware, MySQL workload, and pool design may be completely different.
Interpret broad MySQL capability figures correctly
Oracle’s MySQL 8.0 reference documentation says Linux or Solaris systems should support at least 500 to 1,000 simultaneous connections routinely, and as many as 10,000 when memory is high and per-connection demand is low. Those are broad capability statements under stated conditions, not a tuning recommendation for a particular Ubuntu machine. Your measured peak and resource headroom take precedence.
Method 1: edit Ubuntu’s option file (persistent configuration)
Ubuntu’s packaged MySQL layout commonly puts the server configuration in /etc/mysql/mysql.conf.d/mysqld.cnf. An option-file change is visible to configuration management and survives a restart, but the running server does not use the new value until the service is restarted.
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
- Back up the file or record the current setting so you have a precise rollback point.
- Open the file as root with an editor, for example:
sudoedit /etc/mysql/mysql.conf.d/mysqld.cnf - Locate the
[mysqld]section. If it is absent, create that section in the server-options file. Add or change the setting:[mysqld] max_connections = 300Replace
300with the value justified by your measurements and resource checks. Keep the option under[mysqld]; placing it in a client section will not configure the server.Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. - Save the file and restart the Debian-family service:
sudo systemctl restart mysql.serviceA restart interrupts existing client sessions. Schedule it during an appropriate maintenance window or ensure the application can reconnect.
- Check that systemd considers the service healthy:
sudo systemctl status mysql.service - Reconnect to MySQL and verify the effective value:
SHOW GLOBAL VARIABLES LIKE 'max_connections';
If the restart fails, do not repeatedly retry while production traffic is waiting. Read the service’s error output, restore the last known-good option-file content if necessary, and confirm that the file has valid section and option syntax. A successful systemctl restart followed by a healthy status does not replace checking the variable from a client session.
Method 2: change the live value with SET GLOBAL
SET GLOBAL applies immediately to the running server and does not require a restart. Connect with an account authorized to change global variables, then run:
SET GLOBAL max_connections = 300;
SHOW GLOBAL VARIABLES LIKE 'max_connections';
The second statement confirms the value currently used by the server. This is the fastest way to relieve a temporary, measured connection surge, but the change is not, by itself, the durable Ubuntu option-file configuration. It will not automatically become the value in /etc/mysql/mysql.conf.d/mysqld.cnf, and a later restart can therefore remove it unless you also make a persistent configuration change.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
A live increase can still fail operationally if the host lacks memory or file descriptors. Treat a successful SQL statement as confirmation that MySQL accepted the number, not as proof that the host can sustain that many busy sessions.
Method 3: persist the value with SET PERSIST
SET PERSIST changes the running value and asks MySQL to retain it across restarts:
SET PERSIST max_connections = 300;
SHOW GLOBAL VARIABLES LIKE 'max_connections';
MySQL writes this persisted setting to mysqld-auto.cnf. Use this method deliberately: it is MySQL-managed persistence rather than an edit to Ubuntu’s packaged option file. Keep one clear source of truth. If the same variable is set in both an option file and the persisted settings, administrators can later be unsure which value is intended and which file must be changed to roll it back.
The account must have the authority required to change global variables and persist them. If the statement is rejected, use the error text to identify a privilege or server-version issue rather than repeatedly submitting the command. After it succeeds, verify the live value and document that the persistent setting is managed by MySQL.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Which method should you use?
| Method | Applies now | Survives restart | Operational interruption | Rollback | Best fit |
|---|---|---|---|---|---|
SET GLOBAL |
Yes | No, not by itself | None | Run another SET GLOBAL or restart with the configured value |
Immediate, temporary mitigation while you investigate demand |
SET PERSIST |
Yes | Yes, through MySQL’s mysqld-auto.cnf |
None | Change or remove the persisted setting using MySQL’s persistence mechanism | A durable SQL-managed setting when you want MySQL to own persistence |
| Option-file edit | After restart | Yes, in Ubuntu’s server configuration | Restart required; existing sessions are interrupted | Restore the previous option-file value and restart | Auditable, configuration-managed Ubuntu administration |
Do not combine methods casually. A common operational pattern is to use SET GLOBAL for an emergency, then choose either SET PERSIST or the option file for the long-term setting after reviewing capacity. Record which path you selected and remove an obsolete setting from the other path when appropriate.
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
Verify pressure after the change
Run the status checks again during the workload that prompted the change:
SHOW GLOBAL VARIABLES LIKE 'max_connections';
SHOW GLOBAL STATUS LIKE 'Threads_connected';
SHOW GLOBAL STATUS LIKE 'Threads_running';
SHOW GLOBAL STATUS LIKE 'Connection_errors_max_connections';
- Effective limit: confirms the value the server is using, regardless of how it was set.
Threads_connected: shows how close current open sessions are to that limit.Threads_running: distinguishes many idle pooled sessions from many sessions actively consuming execution resources.Connection_errors_max_connections: rises when MySQL refuses a connection specifically because the maximum was reached. Compare it over time; a nonzero historical value does not mean the server is saturated at this instant.
If the limit rises but the error counter continues increasing, inspect the connection pool and traffic pattern. A burst of short-lived clients, a pool leak, retry storms, or a deployment that multiplies worker counts can exhaust any reasonable ceiling. Raising the number again without addressing that behavior can increase memory pressure while leaving the underlying failure intact.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Check file-descriptor headroom
Increasing max_connections also increases the number of file descriptors that mysqld requires. Connections are not the only consumers: table files, logs, sockets, and other server resources also use descriptors. If MySQL cannot obtain enough, the configured number may be unusable even when RAM appears adequate.
Recommended Free Tools
On an Ubuntu system managed by systemd, inspect the service’s open-file limit and the related operating-system limits when a higher setting does not behave as expected:
systemctl show mysql.service -p LimitNOFILE
Compare the reported limit with the number of connections and the rest of the server's descriptor demand. A low service limit must be addressed through the service's systemd configuration and an appropriate reload/restart procedure for your environment; do not assume that changing a shell's ulimit changes the limit of an already running systemd service. Make one limit change at a time and verify the resulting service limit before increasing MySQL further.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Use the emergency administration slot when the server is full
MySQL permits max_connections + 1 client connections. The extra slot is reserved for an account with the CONNECTION_ADMIN privilege (or the deprecated SUPER privilege), allowing an administrator to connect to a saturated server and inspect or correct it.
Keep a tested administrative account with that privilege and its credentials available through your normal secure operations process. Do not grant broad administrative privileges to application accounts merely to make connection recovery easier. Once connected through the reserved slot, inspect the status counters, identify runaway clients or pools, and reduce demand or adjust the setting carefully.
Troubleshooting common failures
The value changes, then returns after a reboot
You probably used SET GLOBAL without a persistent configuration. Decide whether the long-term owner should be Ubuntu's option file or MySQL's mysqld-auto.cnf, apply that method, and verify after a controlled restart.
The restart fails after editing mysqld.cnf
Check the edited section and spelling, restore the previous known-good file if service availability is urgent, and inspect the MySQL service error output. Confirm that max_connections is under [mysqld] and that the value is an integer your host can support. After correcting the file, restart once and verify both service status and the SQL variable.
MySQL rejects the SQL statement
The account may lack authority to change global variables or to persist them. Use an authorized administrative account and read the server's exact error. A privilege failure is different from a resource failure; changing the number repeatedly will not solve either one without addressing its cause.
Clients still receive “too many connections”
Check Threads_connected and Connection_errors_max_connections from the emergency administrative slot if necessary. Then inspect pool maximums, worker counts, connection-release behavior, and retry loops. If current sessions are far below the new limit, the application may be connecting to a different MySQL instance, using a different configuration, or failing for another reason. Verify the endpoint and run the status query on the server that is actually refusing clients.
The server becomes slow or unstable after increasing the limit
Reduce the setting to a value the host can sustain, stop or throttle the source of the spike, and examine memory and file-descriptor pressure. A larger ceiling allows more simultaneous work; it does not guarantee that CPU, RAM, storage, or locks can process that work within the desired response time.
A safe change and rollback checklist
- Record the current
max_connections,Threads_connected,Threads_running, andConnection_errors_max_connections. - Estimate peak pool demand and include administrative, scheduled, monitoring, and other non-application sessions.
- Check available memory and the systemd
LimitNOFILEvalue before selecting the new ceiling. - Choose one persistence owner: the Ubuntu option file or MySQL's persisted settings.
- For a live-only change, use
SET GLOBAL; for MySQL-managed persistence, useSET PERSIST. - For an option-file change, edit
/etc/mysql/mysql.conf.d/mysqld.cnfunder[mysqld], then restartmysql.service. - Verify the effective value from SQL and monitor the status counters through the next peak period.
- If memory, descriptor, or application pressure appears, roll back to the last sustainable value and fix the demand or host limit before trying again.
Bottom line
Use measured concurrency to select max_connections. Use SET GLOBAL for an immediate, nonpersistent change; use SET PERSIST for MySQL-managed persistence; or edit /etc/mysql/mysql.conf.d/mysqld.cnf and restart mysql.service for a durable Ubuntu configuration. Verify connection errors, memory headroom, and file-descriptor limits after the change, because a higher number is safe only when the entire host and application can support it.
Quick Recap
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.

