docker mysql start failed, unable to create temporary file, permission denied - mysql

ubuntu 14.04
docker 1.8.2
mysql is latest official image
here is my command
vm:~$ docker run --name mysql -d -e MYSQL_ROOT_PASSWORD=123456 mysql
and the tips:
Running mysql_install_db
2015-09-22 08:42:13 0 [Note] /usr/sbin/mysqld (mysqld 5.6.26) starting as process 15 ...
2015-09-22 08:42:13 15 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-22 08:42:13 15 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-22 08:42:13 15 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-09-22 08:42:13 15 [Note] InnoDB: Memory barrier is not used
2015-09-22 08:42:13 15 [Note] InnoDB: Compressed tables use zlib 1.2.7
2015-09-22 08:42:13 15 [Note] InnoDB: Using Linux native AIO
2015-09-22 08:42:13 15 [Note] InnoDB: Using CPU crc32 instructions
/usr/sbin/mysqld: Can't create/write to file '/tmp/ibhzPhSc' (Errcode: 13 - Permission denied)
2015-09-22 08:42:13 7f962ed20720 InnoDB: Error: unable to create temporary file; errno: 13
2015-09-22 08:42:13 15 [ERROR] Plugin 'InnoDB' init function returned error.
2015-09-22 08:42:13 15 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-09-22 08:42:13 15 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-09-22 08:42:13 15 [ERROR] Aborting
2015-09-22 08:42:13 15 [Note] Binlog end
2015-09-22 08:42:13 15 [Note] /usr/sbin/mysqld: Shutdown complete
Anyone has suggestion?

Related

Changing tmpdir in my.cnf causes mysql to fail to restart

I'm trying to change where mysql uses for temporary tables. I have a drive mounted at /media/E, and I've created a directory owned by root with permissions drwxrwxrwxt at /media/E/tmp.
I have changed tmpdir in /etc/mysql/mysql.conf.d/mysqld.cnf to point to this directory.
I then restart mysql like so:
username#grey:/media/E/tmp$ sudo service mysql restart
Yielding the following error:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
Here is the result of systemctl status mysql.service:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-08-05 16:56:07 BST; 3min 11s ago
Process: 28964 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 28938 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 24216 (code=exited, status=0/SUCCESS)
Aug 05 16:56:07 computer systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 05 16:56:07 computer systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Aug 05 16:56:07 computer systemd[1]: Stopped MySQL Community Server.
Aug 05 16:56:07 computer systemd[1]: mysql.service: Start request repeated too quickly.
Aug 05 16:56:07 computer systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 05 16:56:07 computer systemd[1]: Failed to start MySQL Community Server.
mysql error.log:
2021-08-05T15:56:05.385461Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-05T15:56:05.387065Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.35-0ubuntu0.18.04.1) starting as process 28785 ...
2021-08-05T15:56:05.391963Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-08-05T15:56:05.391993Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-08-05T15:56:05.391999Z 0 [Note] InnoDB: Uses event mutexes
2021-08-05T15:56:05.392004Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-08-05T15:56:05.392009Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-05T15:56:05.392014Z 0 [Note] InnoDB: Using Linux native AIO
2021-08-05T15:56:05.392223Z 0 [Note] InnoDB: Number of pools: 1
2021-08-05T15:56:05.392308Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/media/E/tmp/ib0OZZH0' (Errcode: 13 - Permission denied)
2021-08-05T15:56:05.392355Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2021-08-05T15:56:05.392362Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-05T15:56:05.392368Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-05T15:56:05.392372Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-05T15:56:05.392376Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-05T15:56:05.392380Z 0 [ERROR] Aborting
2021-08-05T15:56:05.392398Z 0 [Note] Binlog end
2021-08-05T15:56:05.392455Z 0 [Note] Shutting down plugin 'CSV'
2021-08-05T15:56:05.392742Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2021-08-05T15:56:05.922766Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-05T15:56:05.924030Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.35-0ubuntu0.18.04.1) starting as process 28830 ...
2021-08-05T15:56:05.927684Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-08-05T15:56:05.927705Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-08-05T15:56:05.927711Z 0 [Note] InnoDB: Uses event mutexes
2021-08-05T15:56:05.927716Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-08-05T15:56:05.927720Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-05T15:56:05.927725Z 0 [Note] InnoDB: Using Linux native AIO
2021-08-05T15:56:05.927922Z 0 [Note] InnoDB: Number of pools: 1
2021-08-05T15:56:05.928009Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/media/E/tmp/ibTpGlkH' (Errcode: 13 - Permission denied)
2021-08-05T15:56:05.928121Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2021-08-05T15:56:05.928128Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-05T15:56:05.928133Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-05T15:56:05.928136Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-05T15:56:05.928140Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-05T15:56:05.928143Z 0 [ERROR] Aborting
2021-08-05T15:56:05.928160Z 0 [Note] Binlog end
2021-08-05T15:56:05.928199Z 0 [Note] Shutting down plugin 'CSV'
2021-08-05T15:56:05.928422Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2021-08-05T15:56:06.432240Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-05T15:56:06.433500Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.35-0ubuntu0.18.04.1) starting as process 28876 ...
2021-08-05T15:56:06.437655Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-08-05T15:56:06.437707Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-08-05T15:56:06.437716Z 0 [Note] InnoDB: Uses event mutexes
2021-08-05T15:56:06.437724Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-08-05T15:56:06.437732Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-05T15:56:06.437740Z 0 [Note] InnoDB: Using Linux native AIO
2021-08-05T15:56:06.438087Z 0 [Note] InnoDB: Number of pools: 1
2021-08-05T15:56:06.438218Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/media/E/tmp/ibuYEQaa' (Errcode: 13 - Permission denied)
2021-08-05T15:56:06.438274Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2021-08-05T15:56:06.438285Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-05T15:56:06.438293Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-05T15:56:06.438299Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-05T15:56:06.438306Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-05T15:56:06.438311Z 0 [ERROR] Aborting
2021-08-05T15:56:06.438338Z 0 [Note] Binlog end
2021-08-05T15:56:06.438394Z 0 [Note] Shutting down plugin 'CSV'
2021-08-05T15:56:06.438799Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2021-08-05T15:56:06.933005Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-05T15:56:06.934428Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.35-0ubuntu0.18.04.1) starting as process 28919 ...
2021-08-05T15:56:06.938763Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-08-05T15:56:06.938803Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-08-05T15:56:06.938812Z 0 [Note] InnoDB: Uses event mutexes
2021-08-05T15:56:06.938820Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-08-05T15:56:06.938828Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-05T15:56:06.938836Z 0 [Note] InnoDB: Using Linux native AIO
2021-08-05T15:56:06.939095Z 0 [Note] InnoDB: Number of pools: 1
2021-08-05T15:56:06.939192Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/media/E/tmp/ibrNdqJK' (Errcode: 13 - Permission denied)
2021-08-05T15:56:06.939294Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2021-08-05T15:56:06.939305Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-05T15:56:06.939311Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-05T15:56:06.939317Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-05T15:56:06.939323Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-05T15:56:06.939328Z 0 [ERROR] Aborting
2021-08-05T15:56:06.939373Z 0 [Note] Binlog end
2021-08-05T15:56:06.939481Z 0 [Note] Shutting down plugin 'CSV'
2021-08-05T15:56:06.939965Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2021-08-05T15:56:07.433078Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-05T15:56:07.434360Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.35-0ubuntu0.18.04.1) starting as process 28966 ...
2021-08-05T15:56:07.438280Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-08-05T15:56:07.438321Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-08-05T15:56:07.438326Z 0 [Note] InnoDB: Uses event mutexes
2021-08-05T15:56:07.438331Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-08-05T15:56:07.438335Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-05T15:56:07.438340Z 0 [Note] InnoDB: Using Linux native AIO
2021-08-05T15:56:07.438590Z 0 [Note] InnoDB: Number of pools: 1
2021-08-05T15:56:07.438678Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/media/E/tmp/ibr3ovUd' (Errcode: 13 - Permission denied)
2021-08-05T15:56:07.438726Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2021-08-05T15:56:07.438733Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-05T15:56:07.438738Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-05T15:56:07.438742Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-05T15:56:07.438747Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-05T15:56:07.438750Z 0 [ERROR] Aborting
2021-08-05T15:56:07.438773Z 0 [Note] Binlog end
2021-08-05T15:56:07.438824Z 0 [Note] Shutting down plugin 'CSV'
2021-08-05T15:56:07.439214Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
MySQL is armored by AppArmor, which does not allow writing freely to /media/E/tmp. To remedy the situation, you can edit the /etc/apparmor.d/abstractions/user-tmp and add the /media/E/tmp there appropriately; for me the extra lines
owner /media/E/tmp/** rwkl,
/media/E/tmp/ rw,

Mgt Development Environment - MySQL suddenly won't start

I have 4 containers using mgt-commerce/mgt-development-environment-7.2. Basically everything runs well until I cannot access the control panel. It returns 500.
After checking the services, logs, etc, it seems like mysql is unable to start. Here is the error log captured in /var/log/mysql/error.log during starting mysql service using sudo service mysql start.
2019-09-26T23:38:43.740283Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-09-26T23:38:43.921450Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-29) starting as process 1576 ...
2019-09-26T23:38:43.924613Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-09-26T23:38:43.924635Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-26T23:38:43.924639Z 0 [Note] InnoDB: Uses event mutexes
2019-09-26T23:38:43.924642Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-09-26T23:38:43.924644Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-09-26T23:38:43.924647Z 0 [Note] InnoDB: Using Linux native AIO
2019-09-26T23:38:43.924859Z 0 [Note] InnoDB: Number of pools: 1
2019-09-26T23:38:43.924920Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-09-26T23:38:43.925849Z 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2019-09-26T23:38:43.946744Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-09-26T23:38:43.955252Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-09-26T23:38:43.966654Z 0 [Note] InnoDB: Recovering partial pages from the parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite
2019-09-26T23:38:44.033822Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-09-26T23:38:44.033986Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-09-26T23:38:44.034023Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-09-26T23:38:44.034040Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-09-26T23:38:45.135220Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-09-26T23:38:45.135270Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-09-26T23:38:45.135283Z 0 [ERROR] Failed to initialize builtin plugins.
2019-09-26T23:38:45.135291Z 0 [ERROR] Aborting
2019-09-26T23:38:45.135301Z 0 [Note] Binlog end
2019-09-26T23:38:45.135371Z 0 [Note] Shutting down plugin 'CSV'
2019-09-26T23:38:45.136207Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
Is there anyone using this image ever getting this kind of error?
Update
It seems like mysql doesn't have the access to a particular file(s) or directory(ies), but I'm not sure which file(s) or directory(ies) . Here is the permission of mysql data directory:
clp#magento2dev:/$ ls -la /var/lib | grep mysql
drwxr-x--- 1 mysql mysql 4096 Sep 26 23:38 mysql
drwxrwx--- 2 mysql mysql 4096 Jul 11 15:24 mysql-files
drwxr-x--- 2 mysql mysql 4096 Jul 11 15:24 mysql-keyring

MariaDB Out of memory

My database crash with out of memory error ~1-2 times per day. Last crash was at 17:30 in logs and at 19:30 in metrics (different timezones).
Errors in mariadb.log:
181120 16:09:00 [Warning] IP address '185.156.177.144' could not be resolved: Name or service not known
181120 16:35:40 [Warning] IP address '58.221.58.248' could not be resolved: Name or service not known
181120 17:30:38 mysqld_safe Number of processes running now: 0
181120 17:30:38 mysqld_safe mysqld restarted
181120 17:30:41 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
181120 17:30:41 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 16636 ...
181120 17:30:41 [Warning] Changed limits: max_open_files: 1024 max_connections: 70 table_cache: 472
181120 17:30:41 InnoDB: The InnoDB memory heap is disabled
181120 17:30:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
181120 17:30:41 InnoDB: Compressed tables use zlib 1.2.7
181120 17:30:41 InnoDB: Using Linux native AIO
181120 17:30:41 InnoDB: Initializing buffer pool, size = 150.0M
181120 17:30:42 InnoDB: Completed initialization of buffer pool
181120 17:30:42 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
181120 17:30:42 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
181120 17:30:46 InnoDB: Waiting for the background threads to start
181120 17:30:47 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 18741266161
181120 17:30:47 [Note] Plugin 'FEEDBACK' is disabled.
181120 17:30:48 [Note] Server socket created on IP: '0.0.0.0'.
181120 17:30:49 [Note] Event Scheduler: Loaded 0 events
181120 17:30:49 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
181120 17:30:53 [ERROR] mysqld: Table './admin_wikis/wp_posts' is marked as crashed and should be repaired
181120 17:30:53 [Warning] Checking table: './admin_wikis/wp_posts'
181120 17:31:58 mysqld_safe Number of processes running now: 0
181120 17:31:58 mysqld_safe mysqld restarted
181120 17:32:01 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
181120 17:32:01 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 16899 ...
181120 17:32:01 [Warning] Changed limits: max_open_files: 1024 max_connections: 70 table_cache: 472
181120 17:32:01 InnoDB: The InnoDB memory heap is disabled
181120 17:32:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
181120 17:32:01 InnoDB: Compressed tables use zlib 1.2.7
181120 17:32:01 InnoDB: Using Linux native AIO
181120 17:32:01 InnoDB: Initializing buffer pool, size = 150.0M
InnoDB: mmap(161447936 bytes) failed; errno 12
181120 17:32:01 InnoDB: Completed initialization of buffer pool
181120 17:32:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
181120 17:32:01 [ERROR] Plugin 'InnoDB' init function returned error.
181120 17:32:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
181120 17:32:01 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
181120 17:32:01 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
181120 17:32:01 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
181120 17:32:01 [Note] Plugin 'FEEDBACK' is disabled.
181120 17:32:02 [ERROR] Unknown/unsupported storage engine: InnoDB
181120 17:32:02 [ERROR] Aborting
181120 17:32:02 [Note] /usr/libexec/mysqld: Shutdown complete
There is nothing interesing in apache log in this time. Event requests count
$ sudo grep -r "GET \/" /etc/httpd/logs/domains/ | cut -d' ' -f4 | sed 's/\[//;s/\]//;s/\"//' | cut -d':' -f1-2 | sort | uniq -c
459 19/Nov/2018:03
426 19/Nov/2018:04
239 19/Nov/2018:05
350 19/Nov/2018:06
381 19/Nov/2018:07
415 19/Nov/2018:08
778 19/Nov/2018:09
500 19/Nov/2018:10
450 19/Nov/2018:11
633 19/Nov/2018:12
458 19/Nov/2018:13
527 19/Nov/2018:14
713 19/Nov/2018:15
654 19/Nov/2018:16
573 19/Nov/2018:17
413 19/Nov/2018:18
471 19/Nov/2018:19
499 19/Nov/2018:20
661 19/Nov/2018:21
452 19/Nov/2018:22
773 19/Nov/2018:23
934 20/Nov/2018:00
295 20/Nov/2018:01
369 20/Nov/2018:02
441 20/Nov/2018:03
384 20/Nov/2018:04
927 20/Nov/2018:05
524 20/Nov/2018:06
972 20/Nov/2018:07
612 20/Nov/2018:08
609 20/Nov/2018:09
677 20/Nov/2018:10
753 20/Nov/2018:11
615 20/Nov/2018:12
717 20/Nov/2018:13
474 20/Nov/2018:14
973 20/Nov/2018:15
510 20/Nov/2018:16
534 20/Nov/2018:17
415 20/Nov/2018:18
90 20/Nov/2018:19
I get some metrics:
Processes before crash:
Processes in the moment of crash:
Memory and CPU usage:
Total RAM 3.6G. Does someone have any ideas?
httpd is the largest memory user; decrease its settings, especially the number of 'children' it is willing to spawn. (Under 10 should suffice for most small installations.)
max_connections: 70 table_cache: 472 -- Cut each of those in half; this will help a little with memory allocation.
Next time the CPU hits 100%, do SHOW FULL PROCESSLIST; in MySQL. That may give you a clue of what runaway queries you have. Then we can focus on them. If that fails, turn on the slowlog; it will catch some of them.
Consider moving to an 8GB server. (Is this a cloud server?)

MySQL unexpectedly crashes

I'm running Ubuntu 14.04 and I've got a few WordPress installations on my server.
Without warning, MySQL crashes every day on my server and I've yet to find the reason.
You can find the error.log below.
160721 9:25:44 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160721 9:25:44 [Note] Plugin 'FEDERATED' is disabled.
160721 9:25:44 InnoDB: The InnoDB memory heap is disabled
160721 9:25:44 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160721 9:25:44 InnoDB: Compressed tables use zlib 1.2.8
160721 9:25:44 InnoDB: Using Linux native AIO
160721 9:25:44 InnoDB: Initializing buffer pool, size = 128.0M
160721 9:25:44 InnoDB: Completed initialization of buffer pool
160721 9:25:44 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 40817296
160721 9:25:44 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 41068976
160721 9:25:45 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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
InnoDB: Apply batch completed
160721 9:25:45 InnoDB: Waiting for the background threads to start
160721 9:25:46 InnoDB: 5.5.47 started; log sequence number 41068976
160721 9:25:46 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
160721 9:25:46 [Note] - '127.0.0.1' resolves to '127.0.0.1';
160721 9:25:46 [Note] Server socket created on IP: '127.0.0.1'.
160721 9:25:46 [Note] Event Scheduler: Loaded 0 events
160721 9:25:46 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.47-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
160721 17:50:13 [Note] /usr/sbin/mysqld: Normal shutdown
160721 17:50:13 [Note] Event Scheduler: Purging the queue. 0 events
160721 17:50:13 InnoDB: Starting shutdown...
160721 17:50:14 InnoDB: Shutdown completed; log sequence number 41400934
160721 17:50:14 [Note] /usr/sbin/mysqld: Shutdown complete
160721 17:50:15 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160721 17:50:15 [Note] Plugin 'FEDERATED' is disabled.
160721 17:50:15 InnoDB: The InnoDB memory heap is disabled
160721 17:50:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160721 17:50:15 InnoDB: Compressed tables use zlib 1.2.8
160721 17:50:15 InnoDB: Using Linux native AIO
160721 17:50:15 InnoDB: Initializing buffer pool, size = 128.0M
160721 17:50:15 InnoDB: Completed initialization of buffer pool
160721 17:50:15 InnoDB: highest supported file format is Barracuda.
160721 17:50:15 InnoDB: Waiting for the background threads to start
160721 17:50:16 InnoDB: 5.5.47 started; log sequence number 41400934
160721 17:50:16 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
160721 17:50:16 [Note] - '127.0.0.1' resolves to '127.0.0.1';
160721 17:50:16 [Note] Server socket created on IP: '127.0.0.1'.
160721 17:50:16 [Note] Event Scheduler: Loaded 0 events
160721 17:50:16 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.47-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
160722 5:44:00 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160722 5:44:00 [Note] Plugin 'FEDERATED' is disabled.
160722 5:44:00 InnoDB: The InnoDB memory heap is disabled
160722 5:44:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160722 5:44:00 InnoDB: Compressed tables use zlib 1.2.8
160722 5:44:00 InnoDB: Using Linux native AIO
160722 5:44:00 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160722 5:44:00 InnoDB: Completed initialization of buffer pool
160722 5:44:00 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160722 5:44:00 [ERROR] Plugin 'InnoDB' init function returned error.
160722 5:44:00 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160722 5:44:00 [ERROR] Unknown/unsupported storage engine: InnoDB
160722 5:44:00 [ERROR] Aborting
160722 5:44:00 [Note] /usr/sbin/mysqld: Shutdown complete
160722 5:44:01 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160722 5:44:01 [Note] Plugin 'FEDERATED' is disabled.
160722 5:44:01 InnoDB: The InnoDB memory heap is disabled
160722 5:44:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160722 5:44:01 InnoDB: Compressed tables use zlib 1.2.8
160722 5:44:01 InnoDB: Using Linux native AIO
160722 5:44:01 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160722 5:44:01 InnoDB: Completed initialization of buffer pool
160722 5:44:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160722 5:44:01 [ERROR] Plugin 'InnoDB' init function returned error.
160722 5:44:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160722 5:44:01 [ERROR] Unknown/unsupported storage engine: InnoDB
160722 5:44:01 [ERROR] Aborting
160722 5:44:01 [Note] /usr/sbin/mysqld: Shutdown complete
160722 5:50:30 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160722 5:50:30 [Note] Plugin 'FEDERATED' is disabled.
160722 5:50:30 InnoDB: The InnoDB memory heap is disabled
160722 5:50:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160722 5:50:30 InnoDB: Compressed tables use zlib 1.2.8
160722 5:50:30 InnoDB: Using Linux native AIO
160722 5:50:30 InnoDB: Initializing buffer pool, size = 128.0M
160722 5:50:30 InnoDB: Completed initialization of buffer pool
160722 5:50:31 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 41616363
160722 5:50:31 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 46858752
InnoDB: Doing recovery: scanned up to log sequence number 48741839
160722 5:50:31 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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
InnoDB: Apply batch completed
160722 5:50:32 InnoDB: Waiting for the background threads to start
160722 5:50:33 InnoDB: 5.5.47 started; log sequence number 48741839
160722 5:50:33 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
160722 5:50:33 [Note] - '127.0.0.1' resolves to '127.0.0.1';
160722 5:50:33 [Note] Server socket created on IP: '127.0.0.1'.
160722 5:50:33 [Note] Event Scheduler: Loaded 0 events
160722 5:50:33 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.47-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306
InnoDB: mmap(137363456 bytes) failed; errno 12
Case 1: You have a tiny 1G server (or VM). If so, lower innodb_buffer_pool_size to, say, 32M.
Case 2: You have increased various other mysql settings to unreasonably high values. Undo.
Case 3: You have lots of applications in your small server; they are consuming most of RAM. Find and fix.
If you need further assistance, tell us how much RAM you have, what else is running and provide my.cnf.
Or you could get more RAM.

XAMPP Apache & MySQL Server won't start

aI have the problem that both services won't start. On both, I get the Message
Error: MySQL shutdown unexpectedly. (The same with apache).
I already changed the ports of the apache server from 80 to 8080 and 443 to 4433, and also to others to check, that doesn't help.
I tried some solutions on similar posts here, like deleting the ibdata1-file in the mysql-folder, but none of these seem to work. I even don't think these might solve it, because both services are affected.
Another idea I had was that I had not enough rights on the pc to run these services, but I am logged in as administrator and I also have a postgres-service running which I am able to stop and restart.
I am using Windows 10, but had XAMPP running on it before.
Logfile: Apache
[Wed Jan 13 09:33:31.539128 2016] [core:warn] [pid 5664:tid 572] AH00098: pid file D:/Data/Xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Jan 13 09:33:32.039157 2016] [mpm_winnt:notice] [pid 5664:tid 572] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Wed Jan 13 09:33:32.039157 2016] [mpm_winnt:notice] [pid 5664:tid 572] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Wed Jan 13 09:33:32.039157 2016] [core:notice] [pid 5664:tid 572] AH00094: Command line: 'd:\\data\\xampp\\apache\\bin\\httpd.exe -d D:/Data/Xampp/apache'
[Wed Jan 13 09:33:32.039157 2016] [mpm_winnt:notice] [pid 5664:tid 572] AH00418: Parent: Created child process 4376
[Wed Jan 13 09:33:32.523560 2016] [mpm_winnt:notice] [pid 4376:tid 556] AH00354: Child: Starting 150 worker threads.
Logfile: MySQL
2016-01-13 09:33:33 5760 [Note] Plugin 'FEDERATED' is disabled.
2016-01-13 09:33:33 af8 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2016-01-13 09:33:33 5760 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-13 09:33:33 5760 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-13 09:33:33 5760 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2016-01-13 09:33:33 5760 [Note] InnoDB: Memory barrier is not used
2016-01-13 09:33:33 5760 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-01-13 09:33:33 5760 [Note] InnoDB: Not using CPU crc32 instructions
2016-01-13 09:33:33 5760 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2016-01-13 09:33:33 5760 [Note] InnoDB: Completed initialization of buffer pool
2016-01-13 09:33:33 5760 [Note] InnoDB: Highest supported file format is Barracuda.
2016-01-13 09:33:33 5760 [Note] InnoDB: The log sequence numbers 1665234 and 1665234 in ibdata files do not match the log sequence number 61260762 in the ib_logfiles!
2016-01-13 09:33:33 5760 [Note] InnoDB: Database was not shutdown normally!
2016-01-13 09:33:33 5760 [Note] InnoDB: Starting crash recovery.
2016-01-13 09:33:33 5760 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-01-13 09:33:33 5760 [Note] InnoDB: Restoring possible half-written data pages
2016-01-13 09:33:33 5760 [Note] InnoDB: from the doublewrite buffer...
2016-01-13 09:33:34 5760 [Note] InnoDB: 128 rollback segment(s) are active.
2016-01-13 09:33:34 5760 [Note] InnoDB: Waiting for purge to start
2016-01-13 09:33:34 5760 [Note] InnoDB: 5.6.24 started; log sequence number 61260762
2016-01-13 09:33:34 5760 [Note] Server hostname (bind-address): '*'; port: 3306
2016-01-13 09:33:34 5760 [Note] IPv6 is available.
2016-01-13 09:33:34 5760 [Note] - '::' resolves to '::';
2016-01-13 09:33:34 5760 [Note] Server socket created on IP: '::'.
If I select the xampp-start.exe, I get this message in the cmd-window:
2016-01-14 10:30:28 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2016-01-14 10:30:28 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-14 10:30:28 0 [Note] mysql\bin\mysqld.exe (mysqld 5.6.24) starting as process 1800 ...
2016-01-14 10:30:28 1800 [ERROR] Can't find messagefile 'D:\Data\Xampp\mysql\share\errmsg.sys'
2016-01-14 10:30:28 1800 [Warning] Can't create test file D:\Data\Xampp\mysql\data\DESKTOP-0E1SMUM.lower-test
2016-01-14 10:30:28 1800 [Warning] Can't create test file D:\Data\Xampp\mysql\data\DESKTOP-0E1SMUM.lower-test
mysql\bin\mysqld.exe: Can't change dir to 'D:\Data\Xampp\mysql\data\' (Errcode: 13 - Permission denied)
2016-01-14 10:30:28 1800 [ERROR] Aborting
2016-01-14 10:30:28 1800 [Note] Binlog end
2016-01-14 10:30:28 1800 [Note]
httpd.exe: Syntax error on line 37 of E:/Data/Xampp/apache/conf/httpd.conf: ServerRoot must be a valid directory
The File errmsg.sys exists though.
I found another solution that worked for me!
If anyone has that problem, try to start apache via batch file "apache_start" located in xampp-directory. that gave me the error:
ServerRoot must be a valid directory
This again could be solved by running the "setup_xampp" batch file, located in the same directory. After completion, apache & mysql were running again.