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.

Category
Troubleshooting · Servers & Linux
Time
15–30 min
Last reviewed
What you'll need
  • SSH or console access with sudo
  • Access to the MySQL data directory

Step-by-step diagnostic

Step 1 of 6
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 mysql to 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 mysql and note the error line.
  • Run journalctl -u mysql -n 50 --no-pager to 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.log or /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 mysql shows active (running).
  • mysql -u root -p connects 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.

  1. Status and journalctl systemctl status mysql; journalctl -u mysql -n 50.
  2. MySQL error log Check /var/log/mysql/error.log or /var/log/mysqld.log.
  3. Config, permissions, disk, port Validate config; chown data dir; df -h; ss -tlnp | grep 3306.
  4. 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.

Run `systemctl status mysql`. Failed or inactive: read the status output, then run `journalctl -u mysql -n 50`. Active: MySQL is running—different issue (e.g. connection). Good: you see the error. Bad: status unclear—check the MySQL error log.

You can change your answer later.

MySQL is running

If systemctl status shows active (running), MySQL started. If you have connection issues, see fix-database-will-not-connect.

What does journalctl -u mysql show?

Read systemd logs for the mysql service.

Run `journalctl -u mysql -n 50 --no-pager`. Look for permission denied, config error, address already in use, disk full. Permission denied: check chown on /var/lib/mysql. Address in use: ss -tlnp | grep 3306. Disk full: df -h. Other: check the MySQL error log.
Question

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.

Check `/var/log/mysql/error.log` or `/var/log/mysqld.log`. Read the last 20–50 lines. Permission denied: chown -R mysql:mysql /var/lib/mysql. InnoDB / corruption: may need recovery—escalate. Config error: fix mysqld.cnf or my.cnf. Port in use: stop the conflicting process or change port. Good: you identify the cause. Bad: escalate with the log.

You can change your answer later.

Apply the fix

Fix config, permissions, disk space, or port conflict. Run `sudo systemctl daemon-reload` if you edited a unit file. Run `sudo systemctl start mysql`. Confirm you should see active (running).

Escalate

Escalate if the data directory is corrupted, you suspect hardware failure, or recovery from backup is needed. Provide systemctl status, journalctl -u mysql, and the MySQL error log.

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.

Continue to