EC2 Instance - Wordpress database keeps crashing - mysql

Im not sure why this is but my Wordpress Site keeps crashing with the "There was an error establishing a database connection" error.
Restarting the mysql service seems to temporarily fix this problem but it inevitably crashes again and again.
I thought it may be a memory issue so I upgraded my instance from 1gb to 2gb. But nothing seems to have changed.. I'd rather not pay the massive extra cost for this if it isn't memory related.
Here is some of the mysql log file relating to the crash. All the crashes seem to contain the following:
160519 13:03:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160519 13:03:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160519 13:03:21 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 18275 ...
160519 13:03:21 [Note] Plugin 'FEDERATED' is disabled.
160519 13:03:21 InnoDB: The InnoDB memory heap is disabled
160519 13:03:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160519 13:03:21 InnoDB: Compressed tables use zlib 1.2.8
160519 13:03:21 InnoDB: Using Linux native AIO
160519 13:03:21 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160519 13:03:21 InnoDB: Completed initialization of buffer pool
160519 13:03:21 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160519 13:03:21 [ERROR] Plugin 'InnoDB' init function returned error.
160519 13:03:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160519 13:03:21 [ERROR] Unknown/unsupported storage engine: InnoDB
160519 13:03:21 [ERROR] Aborting
160519 13:03:21 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete
****UPDATE****
So I have changed the size of the innodb_buffer_pool_size as mentioned below and also made a swapfile. My site still crashes every few hours and I am slowly losing the will to live.
160507 16:28:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160507 16:28:20 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 26457 ...
160507 16:28:20 [Note] Plugin 'FEDERATED' is disabled.
160507 16:28:20 InnoDB: The InnoDB memory heap is disabled
160507 16:28:20 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160507 16:28:20 InnoDB: Compressed tables use zlib 1.2.8
160507 16:28:20 InnoDB: Using Linux native AIO
160507 16:28:20 InnoDB: Initializing buffer pool, size = 128.0M
160507 16:28:20 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
160507 16:28:20 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
160507 16:28:21 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
160507 16:28:21 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
160507 16:28:21 InnoDB: Waiting for the background threads to start
160507 16:28:22 InnoDB: 5.5.46 started; log sequence number 0
160507 16:28:22 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160507 16:28:22 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160507 16:28:22 [Note] Server socket created on IP: '0.0.0.0'.
160507 16:28:22 [Note] Event Scheduler: Loaded 0 events
160507 16:28:22 [Note] /usr/libexec/mysql55/mysqld: ready for connections.
Version: '5.5.46' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160507 17:56:05 [Note] /usr/libexec/mysql55/mysqld: Normal shutdown
160507 17:56:05 [Note] Event Scheduler: Purging the queue. 0 events
160507 17:56:05 InnoDB: Starting shutdown...
160507 17:56:06 InnoDB: Shutdown completed; log sequence number 2733606
160507 17:56:06 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete

Your buffer size is too high. It probably does not need to be that size, see this answer on dba.stackexchange.com
https://dba.stackexchange.com/questions/27328/how-large-should-be-mysql-innodb-buffer-pool-size
If you are using Amazon Linux, according to mysql docs (https://dev.mysql.com/doc/refman/5.7/en/ha-vm-aws-setup.html) the setting for this is in /etc/my.cnf
Probably altering the setting in this file to innodb_buffer_pool_size = 10M would fix your problem
The above fixes the specific problem shown in the logs above. If there is another problem being logged which concerns memory use then add a 4GiB swapfile with these commands
/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096; /sbin/mkswap /swapfile; /sbin/swapon /swapfile
Using swap isn't magic it will allow your system to run slow and bloated. However, if this gets you over "blips" in memory usage, it could be good

Related

What to do when I get "mysqld dead but subsys locked" in my amazon ec2 micro instance?

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.
Or, Is there any other solution for this issue. Kindly help.
Have you tried this mysql is dead but subsys locked
Seems quite straightforward. Also please consider moving to RDS instead of running a mysql server in ec2. Saves you from troubles of this kind.

Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12 (Cont.)

I have the same configuration with the following link - Wordpress running on AWS EC2 micro instance with Linux AMI, so implement the answers recommended by adding swapfile. It seems not working properly still. It keeps crashing every 3 - 5 days, so I have to restart it by "sudo service mysqld restart".
Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12
my configuration /etc/my.cnf looks like this:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
innodb_buffer_pool_size = 128M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
And free -m looks like this.
total used free shared buffers cached
Mem: 996 134 861 0 2 16
-/+ buffers/cache: 116 880
Swap: 1023 40 983
I attach /var/log/mysqld.log of past few days. Appreciated to receive recommendations.
160103 04:26:52 mysqld_safe Number of processes running now: 0
160103 04:26:52 mysqld_safe mysqld restarted
160103 4:26:54 [Note] Plugin 'FEDERATED' is disabled.
160103 4:26:54 InnoDB: The InnoDB memory heap is disabled
160103 4:26:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 4:26:54 InnoDB: Compressed tables use zlib 1.2.7
160103 4:26:54 InnoDB: Using Linux native AIO
160103 4:26:54 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160103 4:26:54 InnoDB: Completed initialization of buffer pool
160103 4:26:54 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160103 4:26:54 [ERROR] Plugin 'InnoDB' init function returned error.
160103 4:26:54 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160103 4:26:54 [ERROR] Unknown/unsupported storage engine: InnoDB
160103 4:26:54 [ERROR] Aborting
160103 4:26:54 [Note] /usr/libexec/mysqld: Shutdown complete
160103 04:26:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160103 04:38:51 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160103 4:38:51 [Note] Plugin 'FEDERATED' is disabled.
160103 4:38:51 InnoDB: The InnoDB memory heap is disabled
160103 4:38:51 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 4:38:51 InnoDB: Compressed tables use zlib 1.2.7
160103 4:38:51 InnoDB: Using Linux native AIO
160103 4:38:51 InnoDB: Initializing buffer pool, size = 128.0M
160103 4:38:51 InnoDB: Completed initialization of buffer pool
160103 4:38:51 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!
160103 4:38:51 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...
160103 4:38:52 InnoDB: Waiting for the background threads to start
160103 4:38:53 InnoDB: 5.5.42 started; log sequence number 189468094
160103 4:38:53 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160103 4:38:53 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160103 4:38:53 [Note] Server socket created on IP: '0.0.0.0'.
160103 4:38:53 [Note] Event Scheduler: Loaded 0 events
160103 4:38:53 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160103 04:40:41 mysqld_safe Number of processes running now: 0
160103 04:40:41 mysqld_safe mysqld restarted
160103 4:40:43 [Note] Plugin 'FEDERATED' is disabled.
160103 4:40:44 InnoDB: The InnoDB memory heap is disabled
160103 4:40:44 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 4:40:44 InnoDB: Compressed tables use zlib 1.2.7
160103 4:40:44 InnoDB: Using Linux native AIO
160103 4:40:44 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160103 4:40:44 InnoDB: Completed initialization of buffer pool
160103 4:40:44 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160103 4:40:44 [ERROR] Plugin 'InnoDB' init function returned error.
160103 4:40:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160103 4:40:44 [ERROR] Unknown/unsupported storage engine: InnoDB
160103 4:40:44 [ERROR] Aborting
160103 4:40:45 [Note] /usr/libexec/mysqld: Shutdown complete
160103 04:40:46 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160103 04:42:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160103 4:42:22 [Note] Plugin 'FEDERATED' is disabled.
160103 4:42:22 InnoDB: The InnoDB memory heap is disabled
160103 4:42:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 4:42:22 InnoDB: Compressed tables use zlib 1.2.7
160103 4:42:22 InnoDB: Using Linux native AIO
160103 4:42:22 InnoDB: Initializing buffer pool, size = 128.0M
160103 4:42:22 InnoDB: Completed initialization of buffer pool
160103 4:42:22 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!
160103 4:42:22 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...
160103 4:42:22 InnoDB: Waiting for the background threads to start
160103 4:42:23 InnoDB: 5.5.42 started; log sequence number 189494130
160103 4:42:23 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160103 4:42:23 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160103 4:42:23 [Note] Server socket created on IP: '0.0.0.0'.
160103 4:42:23 [Note] Event Scheduler: Loaded 0 events
160103 4:42:23 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160105 3:28:14 [Note] /usr/libexec/mysqld: Normal shutdown
160105 3:28:14 [Note] Event Scheduler: Purging the queue. 0 events
160105 3:28:14 InnoDB: Starting shutdown...
160105 3:28:17 InnoDB: Shutdown completed; log sequence number 204674622
160105 3:28:17 [Note] /usr/libexec/mysqld: Shutdown complete
160105 03:28:17 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160105 03:28:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160105 3:28:19 [Note] Plugin 'FEDERATED' is disabled.
160105 3:28:19 InnoDB: The InnoDB memory heap is disabled
160105 3:28:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160105 3:28:19 InnoDB: Compressed tables use zlib 1.2.7
160105 3:28:19 InnoDB: Using Linux native AIO
160105 3:28:19 InnoDB: Initializing buffer pool, size = 128.0M
160105 3:28:19 InnoDB: Completed initialization of buffer pool
160105 3:28:19 InnoDB: highest supported file format is Barracuda.
160105 3:28:19 InnoDB: Waiting for the background threads to start
160105 3:28:20 InnoDB: 5.5.42 started; log sequence number 204674622
160105 3:28:20 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160105 3:28:20 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160105 3:28:20 [Note] Server socket created on IP: '0.0.0.0'.
160105 3:28:20 [Note] Event Scheduler: Loaded 0 events
160105 3:28:20 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160109 09:28:55 mysqld_safe Number of processes running now: 0
160109 09:28:55 mysqld_safe mysqld restarted
160109 9:29:02 [Note] Plugin 'FEDERATED' is disabled.
160109 9:29:03 InnoDB: The InnoDB memory heap is disabled
160109 9:29:03 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 9:29:03 InnoDB: Compressed tables use zlib 1.2.7
160109 9:29:03 InnoDB: Using Linux native AIO
160109 9:29:03 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160109 9:29:03 InnoDB: Completed initialization of buffer pool
160109 9:29:03 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160109 9:29:03 [ERROR] Plugin 'InnoDB' init function returned error.
160109 9:29:03 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160109 9:29:03 [ERROR] Unknown/unsupported storage engine: InnoDB
160109 9:29:03 [ERROR] Aborting
160109 9:29:03 [Note] /usr/libexec/mysqld: Shutdown complete
160109 09:29:04 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160109 12:11:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160109 12:11:23 [Note] Plugin 'FEDERATED' is disabled.
160109 12:11:23 InnoDB: The InnoDB memory heap is disabled
160109 12:11:23 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 12:11:23 InnoDB: Compressed tables use zlib 1.2.7
160109 12:11:23 InnoDB: Using Linux native AIO
160109 12:11:23 InnoDB: Initializing buffer pool, size = 128.0M
160109 12:11:23 InnoDB: Completed initialization of buffer pool
160109 12:11:23 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!
160109 12:11:23 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...
160109 12:11:23 InnoDB: Waiting for the background threads to start
160109 12:11:24 InnoDB: 5.5.42 started; log sequence number 209589920
160109 12:11:24 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160109 12:11:24 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160109 12:11:24 [Note] Server socket created on IP: '0.0.0.0'.
160109 12:11:24 [Note] Event Scheduler: Loaded 0 events
160109 12:11:24 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160109 13:22:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160109 13:22:24 [Note] Plugin 'FEDERATED' is disabled.
160109 13:22:24 InnoDB: The InnoDB memory heap is disabled
160109 13:22:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 13:22:24 InnoDB: Compressed tables use zlib 1.2.7
160109 13:22:24 InnoDB: Using Linux native AIO
160109 13:22:24 InnoDB: Initializing buffer pool, size = 128.0M
160109 13:22:24 InnoDB: Completed initialization of buffer pool
160109 13:22:24 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!
160109 13:22:24 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...
160109 13:22:24 InnoDB: Waiting for the background threads to start
160109 13:22:25 InnoDB: 5.5.42 started; log sequence number 209621895
160109 13:22:25 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160109 13:22:25 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160109 13:22:25 [Note] Server socket created on IP: '0.0.0.0'.
160109 13:22:25 [Note] Event Scheduler: Loaded 0 events
160109 13:22:25 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160109 13:22:31 [Note] /usr/libexec/mysqld: Normal shutdown
160109 13:22:31 [Note] Event Scheduler: Purging the queue. 0 events
160109 13:22:33 InnoDB: Starting shutdown...
160109 13:22:35 InnoDB: Shutdown completed; log sequence number 209634722
160109 13:22:35 [Note] /usr/libexec/mysqld: Shutdown complete
160109 13:22:36 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160109 13:22:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160109 13:22:37 [Note] Plugin 'FEDERATED' is disabled.
160109 13:22:37 InnoDB: The InnoDB memory heap is disabled
160109 13:22:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 13:22:37 InnoDB: Compressed tables use zlib 1.2.7
160109 13:22:37 InnoDB: Using Linux native AIO
160109 13:22:37 InnoDB: Initializing buffer pool, size = 128.0M
160109 13:22:37 InnoDB: Completed initialization of buffer pool
160109 13:22:37 InnoDB: highest supported file format is Barracuda.
160109 13:22:37 InnoDB: Waiting for the background threads to start
160109 13:22:38 InnoDB: 5.5.42 started; log sequence number 209634722
160109 13:22:38 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160109 13:22:38 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160109 13:22:38 [Note] Server socket created on IP: '0.0.0.0'.
160109 13:22:38 [Note] Event Scheduler: Loaded 0 events
160109 13:22:38 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160109 13:32:02 mysqld_safe Number of processes running now: 0
160109 13:32:02 mysqld_safe mysqld restarted
160109 13:32:05 [Note] Plugin 'FEDERATED' is disabled.
160109 13:32:06 InnoDB: The InnoDB memory heap is disabled
160109 13:32:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 13:32:06 InnoDB: Compressed tables use zlib 1.2.7
160109 13:32:06 InnoDB: Using Linux native AIO
160109 13:32:06 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160109 13:32:06 InnoDB: Completed initialization of buffer pool
160109 13:32:06 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160109 13:32:06 [ERROR] Plugin 'InnoDB' init function returned error.
160109 13:32:06 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160109 13:32:06 [ERROR] Unknown/unsupported storage engine: InnoDB
160109 13:32:06 [ERROR] Aborting
160109 13:32:07 [Note] /usr/libexec/mysqld: Shutdown complete
160109 13:32:08 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160109 13:40:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160109 13:40:18 [Note] Plugin 'FEDERATED' is disabled.
160109 13:40:18 InnoDB: The InnoDB memory heap is disabled
160109 13:40:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 13:40:18 InnoDB: Compressed tables use zlib 1.2.7
160109 13:40:18 InnoDB: Using Linux native AIO
160109 13:40:18 InnoDB: Initializing buffer pool, size = 128.0M
160109 13:40:18 InnoDB: Completed initialization of buffer pool
160109 13:40:18 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!
160109 13:40:18 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...
160109 13:40:18 InnoDB: Waiting for the background threads to start
160109 13:40:19 InnoDB: 5.5.42 started; log sequence number 209690481
160109 13:40:19 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160109 13:40:19 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160109 13:40:19 [Note] Server socket created on IP: '0.0.0.0'.
160109 13:40:19 [Note] Event Scheduler: Loaded 0 events
160109 13:40:19 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.42' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
160109 13:43:42 mysqld_safe Number of processes running now: 0
160109 13:43:42 mysqld_safe mysqld restarted
160109 13:43:46 [Note] Plugin 'FEDERATED' is disabled.
160109 13:43:47 InnoDB: The InnoDB memory heap is disabled
160109 13:43:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160109 13:43:47 InnoDB: Compressed tables use zlib 1.2.7
160109 13:43:47 InnoDB: Using Linux native AIO
160109 13:43:47 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160109 13:43:47 InnoDB: Completed initialization of buffer pool
160109 13:43:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160109 13:43:47 [ERROR] Plugin 'InnoDB' init function returned error.
160109 13:43:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160109 13:43:47 [ERROR] Unknown/unsupported storage engine: InnoDB
160109 13:43:47 [ERROR] Aborting
160109 13:43:47 [Note] /usr/libexec/mysqld: Shutdown complete
160109 13:43:49 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

MySQL can't start

I have this error when MySQL wants to start:
Starting MySQL..The server quit without updating PID file
And its MySQL error log:
151126 14:34:09 [Note] /usr/sbin/mysqld (mysqld 5.5.44) starting as process 12976 ...
151126 14:34:09 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
151126 14:34:09 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
151126 14:34:09 InnoDB: The InnoDB memory heap is disabled
151126 14:34:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151126 14:34:09 InnoDB: Compressed tables use zlib 1.2.3
151126 14:34:09 InnoDB: Using Linux native AIO
151126 14:34:09 InnoDB: Initializing buffer pool, size = 128.0M
151126 14:34:09 InnoDB: Completed initialization of buffer pool
151126 14:34:09 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!
151126 14:34:09 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...
151126 14:34:09 InnoDB: Waiting for the background threads to start
151126 14:34:10 InnoDB: 5.5.44 started; log sequence number 1595675
151126 14:34:10 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
151126 14:34:10 [Note] - '0.0.0.0' resolves to '0.0.0.0';
151126 14:34:10 [Note] Server socket created on IP: '0.0.0.0'.
151126 14:34:10 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
151126 14:34:10 mysqld_safe mysqld from pid file /var/lib/mysql/vps.hostdl.com.pid ended
CentOS 6 and MySQL 5.5. Please help me. Thanks.
I think your error is telling you what to do
151126 14:34:09 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

MySQL service hung in "Starting" mode

I am trying to install multiple instances of MySQL on a Windows Server 2003 using this link.
First instance which is on port 6699 get configured and working successfully. But when I try to install another instance on default port (3306) MySQL service gets hung on "Starting" status. This is the log
140210 17:13:20 [Note] Plugin 'FEDERATED' is disabled.
140210 17:13:20 InnoDB: The InnoDB memory heap is disabled
140210 17:13:20 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140210 17:13:20 InnoDB: Compressed tables use zlib 1.2.3
140210 17:13:20 InnoDB: Initializing buffer pool, size = 128.0M
140210 17:13:20 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
140210 17:13:21 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140210 17:13:21 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140210 17:13:23 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140210 17:13:26 InnoDB: Waiting for the background threads to start
140210 17:13:27 InnoDB: 1.1.8 started; log sequence number 0
140210 17:13:27 [Note] Server hostname (bind-address): '0.0.0.0'; port: 6699
140210 17:13:27 [Note] - '0.0.0.0' resolves to '0.0.0.0';
140210 17:13:27 [Note] Server socket created on IP: '0.0.0.0'.
140210 17:13:27 [Note] Event Scheduler: Loaded 0 events
140210 17:13:27 [Note] C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld.exe: ready for connections.
Version: '5.5.25' socket: '' port: 6699 MySQL Community Server (GPL)
140210 17:42:18 [Note] Plugin 'FEDERATED' is disabled.
140210 17:42:18 InnoDB: The InnoDB memory heap is disabled
140210 17:42:18 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140210 17:42:18 InnoDB: Compressed tables use zlib 1.2.3
140210 17:42:19 InnoDB: Initializing buffer pool, size = 128.0M
140210 17:42:19 InnoDB: Completed initialization of buffer pool
140210 17:42:19 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!
Observe line 140210 17:42:19 InnoDB: Database was not shut down normally!
InnoDB: The log sequence number in ibdata files does not match
Double check your configuration!
Make a binay backup or entire /var/lib/mysql.
If you don't need most recent data, delete the log files and try to start.
If you need your data, try the followling:
Try innodb_force_recovery = 1 to 6 all six options in an increasing order.
Assume the worst -- innodb disk image corrupted.
If you are lucky you can salvage most of your data, perhaps mysql starts in one of recovery modes, run checksum on each table, see what tables are still ok.
If mysql refuses to start up to certain recovery mode N and crashes on startup with recovery mode N, then go looking for those daily/weekly backups I hope you system was configured to take.

MySQL ...Starting crash recovery

I have searched high and low for a solution to this problem. My MySql gives me the following readout:
121231 20:41:05 [Note] Plugin 'FEDERATED' is disabled.
121231 20:41:05 InnoDB: The InnoDB memory heap is disabled
121231 20:41:05 InnoDB: Mutexes and rw_locks use Windows interlocked functions
121231 20:41:05 InnoDB: Compressed tables use zlib 1.2.3
121231 20:41:05 InnoDB: Initializing buffer pool, size = 512.0M
121231 20:41:05 InnoDB: Completed initialization of buffer pool
121231 20:41:05 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!
121231 20:41:05 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...
121231 20:41:06 InnoDB: Waiting for the background threads to start
121231 20:41:07 InnoDB: 1.1.8 started; log sequence number 124716458
121231 20:41:07 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
121231 20:41:07 [Note] - '0.0.0.0' resolves to '0.0.0.0';
121231 20:41:07 [Note] Server socket created on IP: '0.0.0.0'.
121231 20:41:09 [Note] Event Scheduler: Loaded 0 events
121231 20:41:09 [Note] c:\xampp\mysql\bin\mysqld.exe: ready for connections.
Version: '5.5.27' socket: '' port: 3306 MySQL Community Server (GPL)
Everytime it starts. I've tried deleting files, dropping the database, running Magento's Repair Database Tool, starting all over with a new database but no matter what I get this error.
It makes me uncomfortable because I'm not sure something might get corrupted or IS corrupted. I'm using Windows Vista, and Xampp but I also was using nginX with the same thing showing.
I just recreated a brand new database and now after shutdown (which I have to do sometimes) the error is showing up again! Is this a normal thing or is there somehing wrong?
Thanks
As you can see from the log InnoDB starts crash recovery:
InnoDB: Starting crash recovery.
The reason for that is MySQL shut down wasn't clean. Why? May be MySQL has been exiting too long and OS kills the process (if you reboot the server). Or MySQL crashes due to a bug.