I have a PHP based web application which used MySQL as DBMS. Every few minutes (specially when number of users of web application are more that is around 15 at a time), MySQL shuts down. Here's a log entry from one of the shutdown times. How I can prevent this from happening?
2018-02-13T07:03:39.487586Z 0 [ERROR] Can't create thread to handle new connection(errno= 11) 2018-02-13T07:03:41.741213Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000) 2018-02-13T07:03:41.749821Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000) 2018-02-13T07:03:42.145655Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-02-13T07:03:42.148517Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.21-0ubuntu0.16.04.1) starting as process 2877 ... 2018-02-13T07:03:42.207520Z 0 [Note] InnoDB: PUNCH HOLE support available 2018-02-13T07:03:42.207540Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-02-13T07:03:42.207545Z 0 [Note] InnoDB: Uses event mutexes 2018-02-13T07:03:42.207548Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2018-02-13T07:03:42.207552Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8 2018-02-13T07:03:42.207556Z 0 [Note] InnoDB: Using Linux native AIO 2018-02-13T07:03:42.210157Z 0 [Note] InnoDB: Number of pools: 1 2018-02-13T07:03:42.213440Z 0 [Note] InnoDB: Using CPU crc32 instructions 2018-02-13T07:03:42.215241Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2018-02-13T07:03:42.216012Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12 2018-02-13T07:03:42.216026Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2018-02-13T07:03:42.216031Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2018-02-13T07:03:42.216036Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2018-02-13T07:03:42.216040Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2018-02-13T07:03:42.216045Z 0 [ERROR] Failed to initialize builtin plugins. 2018-02-13T07:03:42.216048Z 0 [ERROR] Aborting 2018-02-13T07:03:42.216058Z 0 [Note] Binlog end 2018-02-13T07:03:42.217964Z 0 [Note] /usr/sbin/mysqld: Shutdown complete