benjo0103
By:
benjo0103

Issue with mysql

October 5, 2013 11.9k views
Hello, I have issue with mysql that gone away, or other words it just stop. Server is brand new, with zpanel and wordpress installed. There is no issue by zpanel, as i did try before without it, and i got same issue, mysql just randomly stop. Can you try to help me find solution !? I did try with support but nothing, they can't or won't help me. I do not have any trafic almost at that site where i have issue. Droplet is on 512RAM plan. I did not try upgrading to better plan because im quite sure that this must be resolved without it as i don't have any trafic. I use Ubuntu... Here is error log of mysql: 131005 14:11:41 [Note] Plugin 'FEDERATED' is disabled. 131005 14:11:41 InnoDB: The InnoDB memory heap is disabled 131005 14:11:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins 131005 14:11:41 InnoDB: Compressed tables use zlib 1.2.3.4 131005 14:11:41 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(135987200 bytes) failed; errno 12 131005 14:11:41 InnoDB: Completed initialization of buffer pool 131005 14:11:41 InnoDB: Fatal error: cannot allocate memory for the buffer pool 131005 14:11:41 [ERROR] Plugin 'InnoDB' init function returned error. 131005 14:11:41 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 131005 14:11:41 [ERROR] Unknown/unsupported storage engine: InnoDB 131005 14:11:41 [ERROR] Aborting 131005 14:11:41 [Note] /usr/sbin/mysqld: Shutdown complete 131005 14:11:43 [Note] Plugin 'FEDERATED' is disabled. 131005 14:11:43 InnoDB: The InnoDB memory heap is disabled 131005 14:11:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins 131005 14:11:43 InnoDB: Compressed tables use zlib 1.2.3.4 131005 14:11:43 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(135987200 bytes) failed; errno 12 131005 14:11:43 InnoDB: Completed initialization of buffer pool 131005 14:11:43 InnoDB: Fatal error: cannot allocate memory for the buffer pool 131005 14:11:43 [ERROR] Plugin 'InnoDB' init function returned error. 131005 14:11:43 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 131005 14:11:43 [ERROR] Unknown/unsupported storage engine: InnoDB 131005 14:11:43 [ERROR] Aborting 131005 14:11:43 [Note] /usr/sbin/mysqld: Shutdown complete 131005 15:15:03 [Note] Plugin 'FEDERATED' is disabled. 131005 15:15:03 InnoDB: The InnoDB memory heap is disabled 131005 15:15:03 InnoDB: Mutexes and rw_locks use GCC atomic builtins 131005 15:15:03 InnoDB: Compressed tables use zlib 1.2.3.4 131005 15:15:03 InnoDB: Initializing buffer pool, size = 128.0M 131005 15:15:03 InnoDB: Completed initialization of buffer pool 131005 15:15:03 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 145271920 131005 15:15:03 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 145413082 131005 15:15:03 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 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 131005 15:15:03 InnoDB: Waiting for the background threads to start 131005 15:15:04 InnoDB: 5.5.32 started; log sequence number 145413082 131005 15:15:04 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 131005 15:15:04 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 131005 15:15:04 [Note] Server socket created on IP: '127.0.0.1'. 131005 15:15:04 [Note] Event Scheduler: Loaded 0 events 131005 15:15:04 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.5.32-0ubuntu0.12.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu) 131005 15:15:05 [ERROR] /usr/sbin/mysqld: Table './zpanel_core/x_bandwidth' is marked as crashed and should be repaired 131005 15:15:05 [Warning] Checking table: './zpanel_core/x_bandwidth' 131005 15:15:05 [ERROR] /usr/sbin/mysqld: Table './zpanel_core/x_mysql_databases' is marked as crashed and should be repaired 131005 15:15:05 [Warning] Checking table: './zpanel_core/x_mysql_databases'
1 comment
14 Answers
MySQL & Apache can each up a lot of RAM. Consequently, on machines w/smaller RAM, you need SWAP: How To Add Swap on Ubuntu 12.04.

If you want to use that small of a droplet with WordPress, you'll get A LOT better performance w/Nginx w/caching (vs. Apache). Here's a good tutorial: How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.
by Etel Sverdlov
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process. This tutorial covers installing wordpress on a LEMP stack (with nginx instead of apache), and then installing varnish.
WEll as i said, i do not have any trafic so im quite sure this was not suppose to happen even on 512 ram.

Is there any way that wordpress have itself cronjob !? Every day around 15:00-16:00 this issue happen.
Trust me, it happens even on 512MB RAM especially when you have a control panel installed. Wordpress doesn't install any cronjobs, it could be zPanel though.

I recommend adding 256mb of swap (replace count=512k with count=256k) https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04 and then running:

echo vm.swappiness = 0 | sudo tee -a /etc/sysctl.conf

sysctl -p
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
Thanks mate. It is always goot to have feedback of acutal user who will tell you that maybe issue is really in you. I thought that 512 RAM without visit must be enough. Also, i did try before installing cpanel and hade same issue.

Problem was that is happening in only specificity time.
Was the problem solved after adding swap, because i am the same issue and adding swap did not solve it.
I also added swap and am having the same issue. Swap helped (instead of crashing nightly, it took two weeks to crash), but didn't solve the problem.

I've just upgraded to 1GB RAM and hopefully that helps.
By the way, I ran this script and it helped identify issues: http://mysqltuner.com
I got the same error a couple of days ago. I have a 1GB Ubuntu LAMP droplet, and the MySQL service stopped after weeks with no issues.

I checked my CloudFlare analytics the day after the problem, and it showed a huge spike in "threats" - one IP hit one of my WordPress sites and it brought MySQL down.

Any thoughts on how I could prevent that from crashing MySQL in the future? Thanks!
@dmack.ca They key error here is:


131005 14:11:43 InnoDB: Fatal error: cannot allocate memory for the buffer pool


That's what indicates MySQL crashed due to lack of memory. Adding a swap file can give you some leeway when you have a big spike like that but don't need more memory on an ongoing basis. See:

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
Thanks, Andrew. I've added a good sized swapfile and I'll keep an eye on it for a while. So far, so good!

I got the same problem. I use CentOS 6, Zpanel for 512M Ram Plan,
and found there is no swap file on system after reading this question.
I will try to add swap and keep an eye on it.

Don't use phpmod it uses far too much memory. Use proxyfcgi and php-fpm, which is outlined in the first article linked on this page: http://wiki.apache.org/httpd/php

Hi i use Centos 7.0 , RAM 1G, still get the same issue.
I use MariaDB 5.5
I also use swap memory about 8Gbs

Have another answer? Share your knowledge.