Question

Mysql Crashes when server is reboot

log 1


2020-06-17T15:55:14.199344Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-17T15:55:14.201848Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30-0ubuntu0.18.04.1) starting as process 1284 ...
2020-06-17T15:55:14.209228Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-06-17T15:55:14.209273Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-06-17T15:55:14.209280Z 0 [Note] InnoDB: Uses event mutexes
2020-06-17T15:55:14.209286Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-06-17T15:55:14.209292Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-06-17T15:55:14.209298Z 0 [Note] InnoDB: Using Linux native AIO
2020-06-17T15:55:14.210487Z 0 [Note] InnoDB: Number of pools: 1
2020-06-17T15:55:14.212518Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-06-17T15:55:14.215334Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-06-17T15:55:14.230260Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-06-17T15:55:14.234012Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-06-17T15:55:14.263438Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-06-17T15:57:25.238353Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3980399339
2020-06-17T15:57:25.238488Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 3980410601
2020-06-17T15:59:36.316075Z 0 [Note] InnoDB: Database was not shutdown normally!
2020-06-17T15:59:36.316134Z 0 [Note] InnoDB: Starting crash recovery.

log 2

 mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-06-17 16:26:07 UTC; 7min ago
  Process: 1618 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

Jun 17 16:26:06 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Control process exited, code=exited status=1
Jun 17 16:26:06 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 17 16:26:06 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: Failed to start MySQL Community Server.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: Stopped MySQL Community Server.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Start request repeated too quickly.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 17 16:26:07 ubuntu-s-2vcpu-2gb-nyc1-01 systemd[1]: Failed to start MySQL Community Server.

what is the problem ?

note: mysql is in blockstrage /mnt/volumexxx but I uses over than 2 mounth


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
June 18, 2020
Accepted Answer

Hi @csselo,

Both logs don’t seem to provide the full information on which can act upon. I can only see it’s failed with status 1 which is usually the code on generic errors.

Anyway, what I’ll recommend is to recreate the issue and once you do and MySQL fails to check your journal like so

journalctl -xe

There the full information should be displayed and then we should be able to act further upon.

Regards, KFSys

alexdo
Site Moderator
Site Moderator badge
October 19, 2020

Hello, all

You can also create a simple bash script to check if MySQL is running and if not to restart it.

#!/bin/bash

# Check if MySQL is running
sudo service mysql status > /dev/null 2>&1

# Restart the MySQL service if it's not running.
if [ $? != 0 ]; then
    sudo service mysql restart
fi

Run this script every 5 minutes using a cron job like this one:

 */5 * * * * /home/user/scripts/monitor.sh > /dev/null 2>&1

Hope that this helps! Regards, Alex

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.