π ~1 min read
Table of contents
Symptom & Impact
Database remains offline, causing application outages and transaction failures.
Environment & Reproduction
Typically follows power loss, forced reboot, or storage errors.
sudo systemctl status mysql
sudo journalctl -u mysql -n 120 --no-pager
mysqladmin ping
Root Cause Analysis
Crash recovery incomplete, corrupted files, or invalid MySQL configuration.
Quick Triage
Check disk health, data directory ownership, and last error logs.
df -h
ls -ld /var/lib/mysql
sudo tail -n 120 /var/log/mysql/error.log
Step-by-Step Diagnosis
Validate configuration and inspect InnoDB recovery messages.
sudo mysqld --verbose --help >/dev/null
grep -RIn "InnoDB|error|crash" /var/log/mysql 2>/dev/null | tail -n 30
stat /var/lib/mysql

Solution – Primary Fix
Correct ownership/config issues, then start MySQL and run checks.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo chown -R mysql:mysql /var/lib/mysql
sudo systemctl restart mysql
mysqladmin ping
mysqlcheck --all-databases --check-upgrade

Solution – Alternative Approaches
Use recovery mode briefly to extract data and repair tables.
sudo systemctl stop mysql
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -e 'SHOW DATABASES;'
Verification & Acceptance Criteria
Service remains active and queries return successfully.
sudo systemctl is-active mysql
mysql -e 'SELECT NOW();'
mysqlcheck --all-databases
Rollback Plan
Restore from latest backup if data corruption persists.
sudo systemctl stop mysql
ls -lh /var/backups | head
sudo systemctl start mysql
Prevention & Hardening
Implement clean shutdown controls and routine backup verification.
systemctl status mysql
mysql -e 'SHOW VARIABLES LIKE "innodb_flush_log_at_trx_commit";'
ls -lh /var/backups
Related Errors & Cross-Refs
Commonly related to full disk conditions and filesystem integrity faults.
Related tutorial: View the step-by-step tutorial for Debian 12.
View all Debian 12 tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
MySQL on Debian recovery and operational best-practice guides.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.