MySQL Server 8 fails to start with exit code 1

Amanda Jennewein
Amanda Jennewein
  • Updated

Updated: June 2024

Audience: Self-hosted Administrators 

Summary:

When MySQL Server 8 fails to start with exit code 1, it typically indicates an issue with the configuration or environment.

Solution

1. Check MySQL Error Logs

The first step is to check the MySQL error log for more details on why the server failed to start.

  • Location of Error Log: The location of the MySQL error log varies based on the operating system and configuration. Common locations include:
    • /var/log/mysql/error.log
    • /var/log/mysql/mysql-error.log
    • /var/log/mysqld.log

To view the error log, use a command like:

sudo cat /var/log/mysql/error.log
 

2. Check System Logs

You can also check the system logs for additional information:

sudo journalctl -xe
 

3. Verify MySQL Configuration

Check the MySQL configuration file (my.cnf or my.ini) for errors. The file is usually in /etc/mysql/ or /etc/.

Common issues include:

  • Incorrect paths
  • Duplicate or conflicting settings

4. Check Disk Space and Permissions

Please ensure that there is enough disk space and that MySQL has the right permissions to access its data directory.

  • Check Disk Space:

df -h

  • Check Permissions:

sudo chown -R mysql:mysql /var/lib/mysql sudo chmod -R 755 /var/lib/mysql

5. Verify MySQL User and Group

Ensure the MySQL service runs under the correct user and group (mysql:mysql).

6. Review InnoDB Configuration

If you use the InnoDB storage engine, issues with InnoDB can prevent MySQL from starting.

Check for problems with InnoDB in the error log and ensure that InnoDB settings in the configuration file are correct.

7. Reinstall MySQL

If the above steps do not resolve the issue, you may need to reinstall MySQL. Please make sure you back up your data before proceeding.

Example Commands for Ubuntu:

  1. Stop MySQL Service:

    sudo systemctl stop mysql
  • Remove MySQL:

    sudo apt-get remove --purge mysql-server mysql-client mysql-common sudo apt-get autoremove sudo apt-get autoclean
  • Reinstall MySQL:
    sudo apt-get update sudo apt-get install mysql-server
  • Start MySQL Service:

    sudo systemctl start mysql

Conclusion

By following these steps, you should be able to find out and fix the issue causing MySQL Server 8 not to start. Checking logs and configurations is crucial to identify the root cause. If you encounter specific error messages in the logs, they can provide more detailed guidance on resolving the issue. 

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.