MySQL / MariaDB Down? Don't Guess — Bring It In for an Initial Evaluation
You arrive at the office, the website is down showing "Error establishing a database connection", or the backend throws "Table is marked as crashed" — most likely MySQL or MariaDB is in trouble. These are the most common databases for Hong Kong SME websites, online shops and internal systems, and when they break the whole business can grind to a halt. But remember: before anything is properly checked, don't copy commands from the internet and run them blindly — many "repair tutorials" make things worse. Below, from a repair technician's perspective, we walk through what to do step by step.
1. What Are MySQL / MariaDB? Who Uses Them?
- MySQL is one of the world's most widely used open-source databases — WordPress sites, online shops, company ERP and membership systems across Hong Kong run on it.
- MariaDB is a fork of MySQL by its original creators. Commands and usage are about 90% identical, many Hong Kong hosting companies have switched to it, and recovery methods are largely the same.
- There are two storage engines: MyISAM (older style, each table stored as separate files, with official repair tools) and InnoDB (the current default, supports transactions, data managed more centrally).
- Physically, data lives as files inside the data directory. For InnoDB, ibdata1 and ib_logfile* are the lifeline — if they're missing or damaged, the whole database may refuse to start.
- Typical scenario: a company server or NAS hosts the website; staff arrive to find the site dead while the server itself seems fine — usually the database layer is at fault.
- Another common scenario: after moving to a new server, an upgrade, or a power cut, MySQL won't start and the log is full of errors.
- Version matters: data files across MySQL 5.7, 8.0 and MariaDB 10.x aren't fully interchangeable — version mismatch during migration is a common cause of death, so we check versions first.
2. Common Failure Modes and Symptoms (Match the Error Message)
- "Table './xxx/yyy' is marked as crashed and should be repaired" — a crashed MyISAM table, the most common case, usually caused by power loss or a server hang.
- Website shows "Error establishing a database connection" (common on WordPress) — usually the MySQL service simply isn't running; it doesn't necessarily mean data is gone.
- "Got error 28 from storage engine" — the disk is full and MySQL can't write. Freeing space usually fixes it, but don't randomly delete things inside the data directory.
- InnoDB-related: "InnoDB: Database page corruption on disk" — page-level corruption, more serious, needs step-by-step assessment.
- "Unknown storage engine 'InnoDB'" or failure to start — possibly a misconfiguration after an upgrade or migration, or an ibdata1 mismatch.
- Human-caused disasters: accidentally deleting ibdata1 or ib_logfile*, or moving the whole data directory away — among the hardest cases, and one wrong move means no way back.
- Underlying issues: bad disk sectors, degraded RAID, NAS power loss — the database is just the victim; the root cause is in the storage layer.
3. First 10 Minutes After Failure: Do and Don't
- Don't reboot the server right away. Read the MySQL error log first, identify which table and which engine failed, and photograph or copy the error messages.
- Immediately copy the entire data directory to another disk or external drive. Don't touch anything until you have a full copy — this is the iron rule.
- Never delete ibdata1, ib_logfile0 or ib_logfile1. They're not just logs — deleting them is like burning the key to the lock.
- Don't copy an innodb_force_recovery setting from the internet and apply it, especially jumping straight to level 6. Higher levels are more destructive; always start low, and don't experiment if you can't read the log.
- Note when it last worked normally, whether there was a power cut, any upgrades, or any migration — this history is critical for diagnosis.
- If a website is affected, note which site and which system is down so we can test against it during inspection.
- Don't rush to reinstall MySQL or the whole server: 'reinstall and it'll be fine' is an illusion — reinstalling often overwrites old data or changes paths, making later recovery harder.
4. How We Inspect It at the Shop (Step by Step)
- Step one is always a full backup: we image or fully copy your entire data directory, and all further attempts are done on the copy — the original stays untouched.
- We read the MySQL error log timeline: when errors started, what happened just before, whether it's a single table or the whole engine.
- We check disk space and disk health (SMART) to rule out underlying causes like "simply full" or "disk dying".
- We check whether my.cnf was modified — especially after migrations or upgrades — and whether paths and parameters still match.
- We try starting MySQL to see if it comes up; if not, we isolate databases one by one to find which one is killing the service.
- For MyISAM tables: back up first, then try official repair tools (REPAIR TABLE / myisamchk). For InnoDB: try mysqldump table by table — what dumps out is what can be saved.
- We assess whether the binary logs are intact and how far they go, to see if point-in-time recovery back to before the failure is possible.
5. Cases We Can Handle at the Shop
- Crashed MyISAM tables: official repair tools exist, making this technically the most straightforward category — many such cases are handled right at the shop.
- Disk-full startup failure: free up space, deal with the logs, and the service usually comes back — the data itself is typically fine.
- Misconfigured settings or wrong paths after migration: correct them and it works without touching the data.
- With a complete backup: restore directly, then replay transactions from the binary log — the cleanest approach.
- Single damaged InnoDB table with the rest healthy: dump the good tables, rebuild the bad one, keeping loss to that one table.
- MySQL service won't start but data files are intact: in most cases we can move the data directory to a healthy environment and dump from there.
- Binary logs intact with a clear corruption point: even if the main data is damaged, knowing when it broke lets us replay from the last dump and recover most transactions.
6. Cases That Need a Lab or the Vendor
- ibdata1 missing or severely damaged with no backup — InnoDB table structures can't be mapped back to data; this needs lab-level work.
- Physical disk damage: clicking sounds, unrecognized drive, spreading bad sectors — the disk itself must be rescued first, which is our sister lab Recoverydata King's territory.
- Suspected ransomware encrypted files inside the data directory: virus analysis comes first — don't treat it as ordinary corruption.
- When all reasonable steps fail to dump or start: we'll tell you honestly instead of charging endless inspection fees for luck-based attempts.
- Enterprises with vendor support contracts: in some situations going straight to Oracle / MariaDB vendor support is faster than going around in circles — we'll advise which route makes most sense.
- ib_logfile missing but ibdata1 intact: sometimes rebuilding the logs can save it, but it's high-risk — don't try it yourself, bring it in for assessment first.
- Whole data directory encrypted by ransomware: besides the database itself, the malware must be dealt with — these cases go in two stages, and we'll look at them together with our sister team.
7. Prevention and Backup Advice (So You Never Come Back for This)
- The 3-2-1 rule: at least three copies of backups, on two different media types, with one copy offsite (e.g. cloud outside the office or another machine).
- Daily automatic mysqldump: schedule a daily dump via the system scheduler. The concept is simple — export the whole database into a text file; for small companies this is plenty.
- Keep the binary log enabled: it records every change, and combined with daily dumps enables point-in-time recovery right up to the second before failure.
- Always test your restores: a backup never test-restored is as good as no backup. Periodically restore on a separate machine to make sure the backup actually works.
- Don't keep backups on the same machine or the same RAID: when the machine dies, the backup dies with it — the most common tragedy we see.
- Before major upgrades or migrations, take one extra manual full backup; verify the service starts right after upgrading — don't wait until next morning to find out.
- Someone should watch disk health and space: set up monitoring that alerts at 90% full or on SMART warnings — don't wait for the explosion.
8. Fees and Time (How It's Calculated)
- Initial evaluation: we read the error log, determine the type and extent of damage, and tell you whether it's recoverable and the general approach — no charge at this stage.
- Formal quotes are per case: based on database size, damage extent, and whether binary-log replay is needed. You'll always get an itemized written quote before we touch anything.
- No recovery, no recovery fee: if assessment says it's not viable, or if we try and truly can't save it, you don't pay for the recovery work.
- Time depends on data volume and damage: a few-GB database versus hundreds of GB is a world apart; we'll give you a realistic expectation at inspection.
- We never quote over the phone: quoting without seeing the error log and data condition is irresponsible, and we don't do that.
- Urgent cases negotiable: if business is halted, we'll prioritize with you — saving the most operation-critical database first instead of waiting for everything at once.
Disclaimer: there is no 100% guarantee in database repair. The extent of corruption, ibdata1 integrity and backup availability directly affect recoverability. After our initial evaluation we'll tell you the real situation honestly — never overstating the chances, never pushing you into a long shot. All fees are confirmed in writing beforehand.
Frequently Asked Questions
I accidentally deleted ibdata1. What happens? Is there any hope?
Very serious. ibdata1 holds the mapping of InnoDB table structures to data — without it, the .ibd files become orphans. Stop all writes immediately, don't start MySQL again, and bring the whole data directory in. Whether anything can be salvaged needs case-by-case assessment; don't try anything else yourself.
The internet told me to set innodb_force_recovery=6 and I did. What now?
innodb_force_recovery ranges from 1 to 6 — higher is more destructive, and 6 makes InnoDB read-only while skipping many checks. Setting it isn't instant doom, but don't experiment with other levels; revert the setting and bring it in so we can check whether anything was damaged.
WordPress shows 'Error establishing a database connection'. Is all data lost?
Not necessarily. It usually just means WordPress can't reach MySQL — common causes are a dead MySQL service, wrong credentials, or exhausted server resources. The data itself is often still intact in the data directory. Don't panic, don't reinstall yet — inspect first.
What's the difference in recovering MyISAM vs InnoDB?
MyISAM stores each table as separate files with official repair tools (REPAIR TABLE) — technically the most straightforward. InnoDB manages data centrally with no one-click fix; recovery relies on dumping and rebuilding, or backup plus binary-log restore. So InnoDB failures are usually more complex and costlier.
I have no backup at all. Is it definitely hopeless?
Not necessarily, but definitely much harder. Without a backup we must repair the damage itself, depending on where and how badly it's broken; with a backup it's a straightforward restore. That's why we keep nagging about backups — it's not scare tactics, the difference is genuinely huge.
Are MariaDB and MySQL recovered the same way?
Largely the same. MariaDB forked from MySQL — data directory layout, mysqldump and binary-log concepts are all compatible, plus a few of its own tools. We'll confirm the version first and match the method; nothing gets mixed up.
How often should I back up?
It depends on how critical the data is. For online shops and transaction systems that change many times a day: at least one daily dump plus binary logging. For an ordinary company site, daily is reasonable too. The point isn't frequency but 'exists + test-restored'. One test-restored daily backup beats ten hourly backups never tested.