Question

Issue with MySQL Server stopping on Ubuntu

I have two wordpress projects on a droplet having 1GB ram, and today the mysql server stopped two times, which led both sites being unnresponsive. I’ve decreased the value of innodb_buffer_pool_size from 134217728 to 104857600, but that didn’t help. I’ve attached the mysql logs below:

2019-01-16T06:37:29.751611Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-01-16T06:37:29.754413Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.24-0ubuntu0.18.04.1) starting as process 24176 … 2019-01-16T06:37:29.763480Z 0 [Note] InnoDB: PUNCH HOLE support available 2019-01-16T06:37:29.763510Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2019-01-16T06:37:29.763515Z 0 [Note] InnoDB: Uses event mutexes 2019-01-16T06:37:29.763520Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2019-01-16T06:37:29.763524Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2019-01-16T06:37:29.763528Z 0 [Note] InnoDB: Using Linux native AIO 2019-01-16T06:37:29.764826Z 0 [Note] InnoDB: Number of pools: 1 2019-01-16T06:37:29.768004Z 0 [Note] InnoDB: Using CPU crc32 instructions 2019-01-16T06:37:29.770837Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2019-01-16T06:37:29.771629Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12 2019-01-16T06:37:29.771653Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2019-01-16T06:37:29.771659Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2019-01-16T06:37:29.771666Z 0 [ERROR] Plugin ‘InnoDB’ init function returned error. 2019-01-16T06:37:29.771671Z 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed. 2019-01-16T06:37:29.771676Z 0 [ERROR] Failed to initialize builtin plugins. 2019-01-16T06:37:29.771679Z 0 [ERROR] Aborting

2019-01-16T06:37:29.771701Z 0 [Note] Binlog end 2019-01-16T06:37:29.771767Z 0 [Note] Shutting down plugin ‘CSV’ 2019-01-16T06:37:29.772530Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

and

2019-01-16T12:50:44.967079Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-01-16T12:50:44.969612Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.24-0ubuntu0.18.04.1) starting as process 30672 … 2019-01-16T12:50:44.978445Z 0 [Note] InnoDB: PUNCH HOLE support available 2019-01-16T12:50:44.978482Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2019-01-16T12:50:44.978488Z 0 [Note] InnoDB: Uses event mutexes 2019-01-16T12:50:44.978492Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2019-01-16T12:50:44.978497Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2019-01-16T12:50:44.978502Z 0 [Note] InnoDB: Using Linux native AIO 2019-01-16T12:50:44.979849Z 0 [Note] InnoDB: Number of pools: 1 2019-01-16T12:50:44.983044Z 0 [Note] InnoDB: Using CPU crc32 instructions 2019-01-16T12:50:44.985170Z 0 [Note] InnoDB: Initializing buffer pool, total size = 100M, instances = 1, chunk size = 100M 2019-01-16T12:50:44.986343Z 0 [ERROR] InnoDB: mmap(107380736 bytes) failed; errno 12 2019-01-16T12:50:44.986364Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2019-01-16T12:50:44.986370Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2019-01-16T12:50:44.986380Z 0 [ERROR] Plugin ‘InnoDB’ init function returned error. 2019-01-16T12:50:44.986387Z 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed. 2019-01-16T12:50:44.986394Z 0 [ERROR] Failed to initialize builtin plugins. 2019-01-16T12:50:44.986399Z 0 [ERROR] Aborting

2019-01-16T12:50:44.986427Z 0 [Note] Binlog end 2019-01-16T12:50:44.986486Z 0 [Note] Shutting down plugin ‘CSV’ 2019-01-16T12:50:44.986919Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

Also I’ve noticed that with barely any traffic on the sites, the system uses a lot of memory, which is probably why the server shuts itself:

          total        used        free      shared  buff/cache   available

Mem: 985 566 111 124 307 152 Swap: 0 0 0

Do you have any ideea why this happens and how can I fix the issue with the mysql server?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Would be nice to post your my.cnf config file content here.

InnoDB (mmap) isn’t able to allocate the memory you set in the pool size. So work your way up from a smaller value for innodb_buffer_pool_size like 32M or even less. But this isn’t the only variable at play. PHP also needs RAM. You need to be very conservative about memory or upgrade it.

Cheers