MYSQL execution failed How To Fix It

We use Monit to monitor server status. Sometimes MYSQL failed to start and execution failed error is display.

The steps that we use to troubleshoot:

  1. Manually stop the mysql service
    /etc/init.d/mysql stop
  2. Manually start the mysql service
    /etc/init.d/mysql start
  3. If this error message is shown, it means your disk space is full and need a free space. Then what we need to do is check the log folder and clear old and unused log
    /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full! ... failed!
  4. To make sure the hard disk is really full, we use this command to check for disk space
    df -h
  5. To remove logs, go to /var/log
  6. To see which logs that have big size and taken up your disk space, use this command to show the file size
    ls -l *
  7. Sometimes you may have multiple logs that needs to be deleted, and the filename format is something like this:
    php7.0-fpm-sp.log.1.gz
    php7.0-fpm-sp.log.2.gz
    php7.0-fpm-sp.log.3.gz
    ..
    php7.0-fpm-sp.log.26.gz

    To remove all logs fileĀ php7.0-fpm-sp.log.1.gz to php7.0-fpm-sp.log.26.gz, use this command

    rm file1.*

    Example

    rm php7.0-fpm-sp.log.*

  8. After deleted all the unused logs, check your free disk space again, and start the mysql service
  9. To empty the entire directory of logs folder, use this command

    rm *

  10. Tips, delete the mysql log and apache log, usually this 2 logs will consume alot of disk space
  11. If you are not sure whether it is safe to delete the logs, try read this topic https://www.sitepoint.com/community/t/var-log-mysql-can-i-delete-it/3391
  12. If you are not sure which folder takes the most disk space, use this command on root user. More article regarding NCDU
    sudo ncdu /