October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Fix WordPress MySQL Crashes on a VPS

A practical, evidence-first runbook for WordPress sites whose MySQL service crashes or restarts on a VPS, with commands, recovery branches, and prevention steps.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A WordPress database-connection error does not prove that MySQL crashed. First confirm whether the mysqld process stopped, then read the MySQL error log at the incident time. That evidence separates an out-of-memory kill, full disk, exhausted file descriptors, runaway query, table corruption, InnoDB recovery failure, and a WordPress-only fault.

Do not repeatedly reboot or run a blanket table repair. Preserve the log and a current backup, make the least destructive change that matches the evidence, and verify the database before troubleshooting plugins or themes.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start by proving whether MySQL actually stopped

When WordPress displays “Error establishing a database connection,” the failure can be in several places: the database service may have exited, the server may be alive but unable to accept connections, credentials or host settings may be wrong, or PHP code may be failing after a successful query. Oracle’s MySQL Reference Manual puts the first diagnostic question plainly: “First, you should try to find out whether the problem is that the mysqld server dies or whether your problem has to do with your client.”

Run these checks from an administrative shell. Substitute the service name used by your distribution; it is commonly mysql or mysqld.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
sudo systemctl status mysql --no-pager
sudo systemctl status mysqld --no-pager
sudo journalctl -u mysql --since "30 minutes ago" --no-pager
sudo journalctl -u mysqld --since "30 minutes ago" --no-pager
pgrep -a mysqld
mysqladmin ping

If one service name returns “unit not found,” that is not itself a crash. Try the other name and inspect the process list. A response such as mysqld is alive means the server is answering that probe; it does not rule out intermittent restarts or a WordPress-side problem. Record the exact time shown by the status output and compare it with the first error seen by visitors.

Preserve evidence before restarting repeatedly

Every restart can overwrite context, trigger another recovery cycle, or make a transient resource problem look random. Capture the state once, then make changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Save service and kernel messages. Copy the relevant output from systemctl status and journalctl. Look for an exit code, a signal, an operating-system out-of-memory kill, failed mounts, or permission errors.
  2. Locate the MySQL error log. Common locations include /var/log/mysql/error.log, a distribution-specific file under /var/log/, or the system journal. The configured path can be confirmed in the server configuration or startup output. Read entries several minutes before and after the incident, not only the final line.
  3. Write down the timeline. Note the first connection failure, the last successful health check, the shutdown or restart timestamp, backup jobs, deployments, traffic spikes, and any VPS maintenance occurring at the same time.
  4. Preserve diagnostic output. Copy stack traces, InnoDB recovery messages, “out of memory” text, disk or file errors, and the final queries shown in a query log. Keep the original timestamps and timezone.
  5. Verify a backup. Before repairing tables or changing InnoDB recovery settings, confirm that a recent database backup can actually be read or restored on a separate location. If no usable backup exists, make a safe copy before destructive work whenever the server can still start.

The error log is the deciding evidence. MySQL documentation identifies corrupted data or index files as common causes of unexpected exits, but a similar WordPress symptom can also come from memory pressure or a PHP failure.

Read the log and classify the failure

Log evidence Likely area Safe next move
Out of memory, an OS “Killed process” message, or abrupt termination with no clean shutdown VPS memory or swap pressure; possibly a runaway process Check memory, swap, competing processes, and the kernel log before tuning MySQL.
No space left on device, inability to write a file, or an almost-full filesystem Disk capacity, inode exhaustion, or a read-only filesystem Measure space and inodes, identify safe files to remove or rotate, and confirm the database directory is writable.
Too many open files, “Can’t open file,” or descriptor-limit warnings Process or system file-descriptor limits Measure the running limit and usage; correct the service limit only after checking connection and table demand.
Repeated InnoDB crash recovery, redo-log errors, assertion failures, or failure while starting InnoDB InnoDB recovery or storage damage Stop improvising. Use the recovery procedure for the installed MySQL version and work from a copy or verified backup.
“Table is marked as crashed,” “Record file is crashed,” or a named MyISAM table MyISAM table or index corruption Back up first, identify the named table, and use the appropriate check or repair tool only for that table.
Clean shutdown followed by a normal start, while WordPress still fails Client configuration, credentials, PHP, plugin, theme, or application load Test a direct database login, then move to WordPress logging and isolation.

Check the VPS resources

MySQL’s troubleshooting checklist calls out memory, disk space, file descriptors, and runaway processes. Check each while the problem is occurring or immediately after a restart; a later idle reading can hide the cause.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Memory, swap, and competing processes

free -h
swapon --show
top
ps aux --sort=-%mem | head -n 15
sudo dmesg -T | grep -i -E 'out of memory|oom|killed process'

Compare total, available, and swap memory rather than treating “free” memory alone as the answer. In top, watch for several PHP workers, backup jobs, web-server workers, or another service consuming memory at the same moment. An OOM-killer entry that names mysqld establishes that the operating system terminated it; an entry naming another process points to broader VPS pressure. Do not increase MySQL buffers blindly: larger caches can make a small VPS fail sooner.

Disk capacity, inodes, and write access

df -h
 df -i
sudo du -xhd1 /var/lib/mysql 2>/dev/null | sort -h
sudo du -xhd1 /var/log 2>/dev/null | sort -h
sudo sh -c 'test -w /var/lib/mysql && echo writable || echo not-writable'

Check the filesystem containing both the MySQL data directory and its logs. A filesystem can report available gigabytes while having no free inodes, so df -i matters. Large binary logs, retained backups, verbose logs, and temporary files are common space consumers; remove or rotate files only according to your retention policy. Never delete files inside the MySQL data directory to create space.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

File descriptors and runaway process counts

ulimit -n
pid=$(pidof mysqld | awk '{print $1}')
[ -n "$pid" ] && sudo grep -i 'open files' /proc/$pid/limits
[ -n "$pid" ] && sudo ls /proc/$pid/fd | wc -l
ps -eLf | wc -l

The shell’s ulimit is not necessarily the limit applied to the systemd service. Compare the running process’s limit with its open-descriptor count and with the number of active connections and tables. Raise a service limit only after establishing that exhaustion is the failure; otherwise you may conceal a connection leak.

Restart only after capturing the cause

If the service is stopped and the log shows no unresolved corruption or recovery failure, a single controlled restart can restore availability:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
sudo systemctl restart mysql
sudo systemctl status mysql --no-pager
mysqladmin ping

Use mysqld instead of mysql when that is the installed unit. A successful restart is not a root-cause fix. Keep the incident timestamp and watch the log and resource metrics afterward. If startup fails, stop retrying and follow the failure-specific branch below.

Investigate a query that precedes each crash

A repeatable statement can exhaust memory, trigger a server bug, or expose a damaged table. MySQL documents enabling the general query log when a repeatable query appears to kill the server and examining the final statement before the restart.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the general query log briefly

Enable it only on a controlled or maintenance window because it records every statement and can grow quickly. The exact setting method depends on the MySQL version and configuration; make the change temporarily, reproduce the failure if safe, then disable it and preserve the relevant tail.

SET GLOBAL general_log = 'ON';
-- reproduce or wait for the failure while monitoring disk space
SET GLOBAL general_log = 'OFF';

Do not enable verbose logging on a busy public site without a size and retention plan. If the last statement is a large import, report-generation query, or repeated request from one endpoint, capture its execution context and parameters without exposing credentials.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Use the slow log and EXPLAIN for load problems

When the server remains alive but becomes unresponsive under load, the slow query log is safer for ongoing analysis. Run EXPLAIN on the identified SELECT (and the version-appropriate extended or analyzed form where supported) to look for full table scans, missing indexes, unexpectedly large row estimates, or joins that multiply results. Optimize the query or its calling plugin after confirming the database is structurally sound; do not “fix” a performance symptom by deleting data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Repair MyISAM corruption only when the log names it

WordPress installations may contain legacy MyISAM tables, although many current tables use InnoDB. Errors such as “Record file is crashed” or a named MyISAM table justify a targeted check. A generic connection error does not.

  1. Make or verify a current backup and record the affected database and table names.
  2. Prevent writes to the affected table by placing the site in maintenance mode or stopping the application path that writes to it.
  3. Check the table with the appropriate MySQL utility or SQL command for your server version. Use the least invasive check first.
  4. Repair only the named MyISAM table with the documented repair method, then inspect warnings and row counts.
  5. Test representative WordPress actions and review the error log for new corruption messages.

Repair can discard unrecoverable rows and is not an InnoDB procedure. Never run a blanket repair across every WordPress table simply because the front end reports a database error.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Treat InnoDB startup recovery as a separate incident

InnoDB recovery failures commonly appear as repeated recovery messages, assertions, redo-log errors, or a server that exits while initializing InnoDB. The correct response is version-specific and backup-first. Recovery modes are emergency extraction tools, not routine performance settings.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
  1. Stop automatic restart loops so the server does not repeatedly modify its state.
  2. Copy the data directory and preserve the original error log, configuration, and exact MySQL version.
  3. Consult the recovery procedure for that MySQL release and start with the least aggressive recovery setting.
  4. If the server starts in a recovery mode, export the data to a new instance immediately; do not continue normal writes.
  5. Rebuild or restore the affected instance from a verified backup, then validate tables and application behavior before returning traffic.

Do not delete InnoDB data files, redo logs, or system tablespaces to force startup. Do not raise a recovery mode number without a rollback plan; higher modes can sacrifice more data and are not reversible repairs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When MySQL is healthy but WordPress still fails

If mysqladmin ping succeeds, the service remains running, and the error log shows no new failure, test the client path. Confirm the database name, user, password, host, port, socket setting, and privileges in wp-config.php. A direct login using the same credentials distinguishes a WordPress configuration problem from a server problem.

For a PHP fatal error, plugin conflict, or theme fault, WordPress Recovery Mode provides a temporary safe login path that lets an administrator deactivate the component or inspect its error. Recovery Mode does not restart MySQL and cannot repair a stopped database service. Use it only after the database accepts connections.

Correlate PHP errors with the database timeline

On a controlled maintenance instance, enable WordPress debugging and logging in wp-config.php before the line that says to stop editing. A typical diagnostic configuration is:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reproduce the failure, then compare wp-content/debug.log timestamps with the MySQL error log, web-server log, and VPS resource readings. This can reveal a plugin fatal immediately before the connection message or a request pattern that triggers expensive queries. Turn verbose debugging off on public production after collecting the needed evidence; logs can contain paths, query details, or other sensitive data.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the remedy by evidence and risk

Remedy Evidence required Data risk Reversibility What it addresses
Free disk space or rotate logs Full filesystem or inode count Low if retention rules are followed; high if database files are deleted Usually reversible Storage exhaustion
Stop a runaway process and restart MySQL once Resource spike or stopped service without corruption evidence Low to moderate; uncommitted work can be lost Reversible Transient resource exhaustion or a crashed process
Raise memory or descriptor limits Measured exhaustion at the service limit, with headroom on the VPS Moderate; can destabilize the host if oversized Reversible configuration change Capacity limits
Optimize a query General or slow log evidence and an execution plan Low when tested; query-result changes must be checked Reversible in code or schema Query behavior and load
Repair a MyISAM table Log names MyISAM corruption or a crashed record file Moderate to high; damaged rows may be lost Not reliably reversible without a backup Table or index corruption
Use InnoDB recovery mode and export Startup failure during InnoDB recovery High; emergency modes can expose incomplete data Not a normal reversible change InnoDB recovery failure
Deactivate a plugin or theme in Recovery Mode MySQL is healthy and PHP or WordPress logs identify an application fault Low to moderate; site functionality may change Usually reversible WordPress code faults

Prevent the next crash

  • Maintain current, restorable database backups and periodically test a restore rather than checking only that a backup file exists.
  • Monitor disk usage, inode usage, memory, swap, CPU, connection counts, and service restarts on the VPS.
  • Review MySQL and web-server error logs after WordPress, plugin, theme, PHP, or operating-system updates.
  • Keep the exact MySQL, PHP, Linux, and WordPress versions in the incident record; recovery instructions and defaults vary by release.
  • Set log rotation and retention limits, especially if query logging is enabled for diagnosis.
  • Document the MySQL service name, data directory, error-log path, backup location, and the command used to verify a healthy response.
  • Investigate recurring memory or query spikes instead of masking them with frequent restarts.

A concise decision path

  1. WordPress reports a database error: check service status, mysqladmin ping, and the error log before changing files.
  2. MySQL is stopped: classify the log as resource, storage, MyISAM, InnoDB, or unknown; capture a backup and follow only that branch.
  3. MySQL is alive but overloaded: inspect memory, disk, descriptors, processes, and query logs; address the measured bottleneck.
  4. MySQL is healthy and PHP logs show a fatal: use Recovery Mode to isolate the plugin or theme, then retest.
  5. The cause remains unclear: preserve exact logs, versions, timestamps, and configuration rather than repeatedly rebooting or repairing tables.

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.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.