4

I have an Amazon ec2 micro instance that holds a WordPress site. Since yesterday, my mysql db keep crashing saying:

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo service mysqld status
mysqld dead but subsys locked

I tried restarting the mysqld but after every 5 mins it keeps crashing with the same message - "Error establishing a database connection"

This is what my DB log file reads -

160123 05:44:41 mysqld_safe mysqld restarted
160123  5:44:43 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 7928 ...
160123  5:44:44 [Note] Plugin 'FEDERATED' is disabled.
160123  5:44:46 InnoDB: The InnoDB memory heap is disabled
160123  5:44:46 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160123  5:44:46 InnoDB: Compressed tables use zlib 1.2.8
160123  5:44:46 InnoDB: Using Linux native AIO
160123  5:44:46 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160123  5:44:46 InnoDB: Completed initialization of buffer pool
160123  5:44:46 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160123  5:44:46 [ERROR] Plugin 'InnoDB' init function returned error.
160123  5:44:46 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160123  5:44:46 [ERROR] Unknown/unsupported storage engine: InnoDB
160123  5:44:46 [ERROR] Aborting    
160123  5:44:46 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete
160123 05:44:46 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

The common solution that found out there when I Googled for a solution for the issue - mysqld dead but subsys locked, is to create a swapfile. I did exactly as most of the solution suggest but since I'm not well versed with UNIX, I don't know what I have done is right or not.

I have a swap space of 1MB.

[ec2-user@ip-xx-xx-xx-xxx /]$ free
             total       used       free     shared    buffers     cached
Mem:       1019452     613820     405632         76      19124      64348
-/+ buffers/cache:     530348     489104
Swap:      1048572      46604    1001968

enter image description here

Or, Is there any other solution for this issue. Kindly help.

0

Fatal error: cannot allocate memory for the buffer pool

You have only 1GB of RAM? What is the value of innodb_buffer_pool_size; it should not be more than, say, 50M.

What changes did you make to my.cnf? There may be other things to decrease. (Or you could get more RAM.)

More

If you have more than just MySQL in that 1GB, it may really be impractical to have such a tiny VM. Either split into to VMs, one for MySQL and one for app, or get get a bigger VM.

  • innodb_buffer_pool_size is set at 128M. This is what my my.cnf reads: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid – Arun Antony Jan 24 '16 at 6:37
  • (I think free is in KB, not Bytes; swap seems to be 1GB, not 1MB.) – Rick James Jan 24 '16 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.