Fix MySQL that will not start
We'll check systemctl status, journalctl, the MySQL error log, config and permissions, disk space, and port conflicts—or tell you when to escalate.
What you'll need
- SSH or console access with sudo
- Access to the MySQL data directory
Step-by-step diagnostic
Quick triage — pick your path
Quick triage — pick your path
Choose the option that matches what you see. You can jump straight to that section.
- Follow this guide Work through the full procedure from status to error log.
- Check status and logs You want to see the error first.
- Check error log You need the MySQL-specific error.
- Fix config or permissions You know the config or permissions are wrong.
- When to escalate Data corruption or recovery needed.
Show full guide
Steps
Goal: Confirm the problem, read systemctl status, journalctl, and the MySQL error log, then fix config, permissions, disk, or port.
- Run
systemctl status mysqlto see the current state. - Good: You see failed or inactive with an error hint. Proceed to Check status and logs.
- Bad: Status shows active—MySQL is running; see fix-database-will-not-connect for connection issues.
Check status and logs
Goal: Read systemd status and journalctl to identify the error.
- Run
systemctl status mysqland note the error line. - Run
journalctl -u mysql -n 50 --no-pagerto read recent logs. - Good: You see permission denied, config error, address in use, or disk full. Proceed to Check error log.
- Bad: Unclear—check the MySQL error log next.
Check error log
Goal: Read the MySQL error log for the exact failure reason.
- Check
/var/log/mysql/error.logor/var/log/mysqld.log. On some systems it is in the data directory. - Read the last 20–50 lines. MySQL writes the failure reason before exiting.
- Good: You see the error (e.g. “Permission denied”, “InnoDB: Unable to lock”, “Can’t find messagefile”). Proceed to Fix config or permissions.
- Bad: Corruption or InnoDB recovery needed—escalate.
Fix config or permissions
Goal: Fix the cause identified from the logs.
- Permission denied: Run
sudo chown -R mysql:mysql /var/lib/mysql. - Config error: Validate with
mysqld --validate-config. Fix /etc/mysql/mysql.conf.d/mysqld.cnf or /etc/my.cnf. - Disk full: Run
df -h, free space on the partition with /var/lib/mysql. - Port 3306 in use: Run
ss -tlnp | grep 3306, stop the conflicting process or change the port in the config. - Run
sudo systemctl start mysql. Confirm you should see active (running).
When to escalate
When to get help: If the data directory is corrupted or InnoDB recovery is needed, call a professional—do not attempt recovery yourself. When you suspect hardware failure or need recovery from backup, contact your database vendor or a DBA.
Provide systemctl status, journalctl -u mysql, and the MySQL error log.
Verification
systemctl status mysqlshows active (running).mysql -u root -pconnects from the server.- No errors in the MySQL error log after startup.
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Status and journalctl systemctl status mysql; journalctl -u mysql -n 50.
- MySQL error log Check /var/log/mysql/error.log or /var/log/mysqld.log.
- Config, permissions, disk, port Validate config; chown data dir; df -h; ss -tlnp | grep 3306.
- Escalate Provide status, journalctl, and MySQL error log.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- systemctl status mysql output
- journalctl -u mysql -n 100 output
- MySQL error log (last 50 lines)
- Steps already tried
What does systemctl status mysql show?
Run systemctl status mysql to see the state and error.
You can change your answer later.
MySQL is running
What does journalctl -u mysql show?
Read systemd logs for the mysql service.
What does journalctl show?
You can change your answer later.
What does the MySQL error log show?
Check /var/log/mysql/error.log or /var/log/mysqld.log.
You can change your answer later.
Apply the fix
Escalate
Reviewed by Blackbox Atlas
Frequently asked questions
- Why would MySQL not start?
- Config error, permission denied on the data directory, disk full, port 3306 already in use, or corrupted data files. Check systemctl status, journalctl -u mysql, and the MySQL error log.
- Can I fix MySQL that will not start myself?
- Yes. Read the error log, fix config syntax, check permissions on /var/lib/mysql, confirm disk space, and resolve port conflicts. Run mysqld_safe --help for options.
- When should I escalate MySQL start failures?
- If the data directory is corrupted, you suspect hardware failure, or the fix requires recovery from backup. Provide systemctl status, journalctl output, and the MySQL error log.
Rate this guide
Was this helpful?
Thanks for your feedback.