Question

MySQL stopped and it can't be restart

Posted November 5, 2021 61 views
MySQL

Hi there,

I have a big issue on my server.

Today, I can’t connect to mysqldb and now I am not able to restart it.

If I try:

sudo service mysql restart

It says me:

Job for mysql.service failed because the control process exited with error code. 
See "systemctl status mysql.service" and "journalctl -xe" for details.

Log of journalctl -xe says:

Nov 05 13:03:55 vps480324 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 05 13:03:55 vps480324 systemd[1]: mysql.service: Unit entered failed state.
Nov 05 13:03:55 vps480324 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 05 13:03:55 vps480324 sudo[20041]: pam_unix(sudo:session): session closed for user root
Nov 05 13:03:56 vps480324 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 05 13:03:56 vps480324 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 05 13:03:56 vps480324 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 05 13:03:57 vps480324 audit[20184]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20158/task/20184/mem" pid=20184 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Nov 05 13:03:57 vps480324 kernel: audit: type=1400 audit(1636113837.128:3026): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20158/task/20184/mem" pid=20184 comm="mysqld" requested_mask="r" denied_mask="r"
Nov 05 13:03:57 vps480324 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 05 13:04:02 vps480324 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:91:be:4b:5a:c7:17:83:c3:e9:08:00 SRC=89.248.165.53 DST=51.255.194.37 LEN=40 TOS=0x00 PREC=0x00 TTL=246 ID=26449 PROTO=TCP SPT=54626 DPT=7163 WINDOW=1024 RES=0x00
Nov 05 13:04:23 vps480324 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:91:be:4b:5a:c7:17:83:c3:e9:08:00 SRC=118.31.42.224 DST=51.255.194.37 LEN=40 TOS=0x00 PREC=0x00 TTL=231 ID=43625 PROTO=TCP SPT=53854 DPT=2376 WINDOW=1024 RES=0x00

And finally /var/log/mysql/error.log says:

2021-11-05T12:13:05.209415Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2021-11-05T12:13:05.209533Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2021-11-05T12:13:05.401005Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-05T12:13:05.403335Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30-0ubuntu0.16.04.1) starting as process 22248 ...
2021-11-05T12:13:05.410694Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-11-05T12:13:05.410733Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-11-05T12:13:05.410738Z 0 [Note] InnoDB: Uses event mutexes
2021-11-05T12:13:05.410746Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-11-05T12:13:05.410750Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2021-11-05T12:13:05.410761Z 0 [Note] InnoDB: Using Linux native AIO
2021-11-05T12:13:05.411329Z 0 [Note] InnoDB: Number of pools: 1
2021-11-05T12:13:05.411633Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-11-05T12:13:05.414121Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-11-05T12:13:05.424929Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-11-05T12:13:05.428702Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-11-05T12:13:05.442554Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-11-05T12:13:05.444438Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 13753763283
2021-11-05T12:13:05.444464Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 13753775933
2021-11-05T12:13:05.444907Z 0 [Note] InnoDB: Database was not shutdown normally!
2021-11-05T12:13:05.444921Z 0 [Note] InnoDB: Starting crash recovery.
2021-11-05T12:13:05.460036Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
2021-11-05T12:13:05.463814Z 0 [Note] InnoDB: Apply batch completed
2021-11-05T12:13:05.600596Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-11-05T12:13:05.600629Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-11-05T12:13:05.600675Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-11-05T12:13:06.187911Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-11-05T12:13:06.189011Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-11-05T12:13:06.189034Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-11-05T12:13:06.189399Z 0 [Note] InnoDB: Waiting for purge to start
12:13:06 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 76388 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7fae300008c0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7fae3f7fdca0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x3b)[0xe8b15b]
/usr/sbin/mysqld(handle_fatal_signal+0x36f)[0x77279f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fae5f61d390]
/usr/sbin/mysqld[0x118d6a3]
/usr/sbin/mysqld(_Z14fseg_free_pagePhmmbP5mtr_t+0x171)[0x118efb1]
/usr/sbin/mysqld(_Z12btr_compressP9btr_cur_tmP5mtr_t+0xb26)[0x10d8056]
/usr/sbin/mysqld(_Z26btr_cur_compress_if_usefulP9btr_cur_tmP5mtr_t+0xae)[0x10e450e]
/usr/sbin/mysqld(_Z26btr_cur_pessimistic_deleteP7dberr_tmP9btr_cur_tmbP5mtr_t+0x759)[0x10ea159]
/usr/sbin/mysqld[0x10291d3]
/usr/sbin/mysqld(_Z14row_purge_stepP9que_thr_t+0x601)[0x102b7e1]
/usr/sbin/mysqld(_Z15que_run_threadsP9que_thr_t+0xa69)[0xfd8219]
/usr/sbin/mysqld(_Z9trx_purgemmb+0xab5)[0x108cf85]
/usr/sbin/mysqld(srv_purge_coordinator_thread+0x445)[0x1061d95]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fae5f6136ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fae5eaa84dd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 0
Status: NOT_KILLED

Thanks in advance, any help will be appreciated.

edited by bobbyiliev

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.

×
Submit an Answer
1 answer

Hello,

In many cases, MySQL crashes due to the lack of disk space. You could check the available disk space on your server with the following command:

df -h

You could follow the steps here on how to clear up some disk space and then try to restart MySQL again:

https://www.digitalocean.com/community/questions/28-no-space-left-on-device-error

If this is not the case, I would recommend reverting any changes made to the MySQL config. Or if you wish you could share the MySQL config here along with the amount of available RAM on your server.

Best,
Bobby