MYSQL Stop working on every morning

12 posts / 0 new
Last post
#1 Mon, 08/12/2019 - 11:44

MYSQL Stop working on every morning

hi i need help related mysql mysql stop working every morning i see in all site currently 6 websites are hosted in virtual server i reboot server all site start working so whats a issues why mysql stoped working can any one help me out ?

using virtualmin gpl version. 1 gb ram aws server. 6 website running on server without any issue. webmin updated and working well so whats wrong ??

can any one help me out to solve this issues.

Mon, 08/12/2019 - 20:54
RJM Web Design
RJM Web Design's picture

Have you checked the log file? (I don't know where it is on AWS, but on my CentOS 7 installation it's at /var/log/mariadb/mariadb.log.)

Is it at exactly the same time every morning?

Is there some cron job that might be associated with it (updating stats logs, for example)?


Mon, 08/12/2019 - 22:38

/var/log/mariadb/mariadb.log permission denied

so i i upload direct var file to you in file manager

show on try to get log ?

Code: 2002

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

not sure of time every 4 to 5 hour i see websites stop working

Tue, 08/13/2019 - 07:09
RJM Web Design
RJM Web Design's picture

You have many errors in that scary-looking log, but my hunch is that this one

InnoDB: Fatal error: cannot allocate memory for the buffer pool

may be key.

Does your system have a swap file? I don't know anything (and I mean that literally) about AWS Linux implementations nor what commands are supported, but try running free -m to get some idea of your memory and swap situation.

Also, what's the SELinux status? sestatus , or getenforce if that doesn't work.


Tue, 08/13/2019 - 12:34

Detail total used free shared buff/cache available

Mem: 989 503 112 282 373 77 Swap: 266 266 0

SELinux status: disabled

[root@server ~]# getenforce Disabled

hi plz check details

Tue, 08/13/2019 - 16:31

1 GB memory is on the low side for websites that run mysql fact I would argue it's not enough to avoid troubles.

I had similar problems on a server with 2gb memory.

The truth is, unless your websites are all static html, then you need a server with at least double that amount of RAM.

Also, 200-250 mb swap is too small...A single WordPress website uses that much at times.

Swap needs to also be doubled as an absolute minimum.

Ideally, your system should be as follows

4gb memory

1-2 gb swap

6 WordPress websites will run on this without problems. The issue isn't actually caused by virtualmin btw, it's actually your webserver (Apache) configuration. Each "apache worker process" in your memory stats, ( for WordPress websites) will most likely be something like 500mb. If you have 6 websites on it...well, that's potentially upwards of 3 GB of memory. Hence your problems.

Usually what happens is the memory usage begins to climb after each restart until the system runs out of memory and starts using the swap file for everything. Then once that is fully utilised, boom, something capitulates (such as mysql)

To be honest, you can play around with efficiency all you like, but in the end, like many before you, you will realise the only solution is to increase RAM as that system you are running cannot support so many websites that use mysql without some very fancy configuration (that requires quite a deal of experience)

As a short term solution, you can configure Virtualmin to automatically restart server processes (such as mysql, bind, apache, proftp etc) that have stopped functioning. I am replying on my phone...I can't think of the menu where it's done off the top of my head, sorry.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

Fri, 08/16/2019 - 00:42

hi sharing solution for aws users 1 gb ram

i follow all steps and add one line innodb_buffer_pool_size=64M

mysql not stop last 3 days i test its 100% working step

Fri, 08/16/2019 - 18:31 (Reply to #7)
RJM Web Design
RJM Web Design's picture

I'm glad you found a workaround.

I suggest you keep an eye on the sites for a while. 64M sounds a bit lean to me. But I'm no WP expert.


Sat, 08/17/2019 - 02:21

The truth is, this solution is nothing more than a bandaid. If you read the stack exchange thread carefully you will note the following, and I quote...

The problem is that the server does not have enough memory to allocate for MySQL process. 

The very first thing they offer as a solution is to buy more RAM!

The second, increase swap file size

Last option, reduce innodb buffer size for mysql...which works but isn't a real long term solution.

Ultimately, you will be forced to get more RAM as this is not the only problem you will experience on a machine with such low RAM. In time you will see...I have been down this pathway before and I always end up back at the same place...increasing ram. Virtualmin running around 6 basic WordPress websites actually works best with about 4GB Memory. Mine is running almost flawlessly since I increased to this value.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

Sat, 08/17/2019 - 09:26

yup i agree my website is very lite weight and i did not using whmcs i using boxbilling its can not cross more then 54mb over all function like whmcs i think 1 main website and 3 sub-domain of website is ok for 1 gb ram and all my 24 remaining clients are my re seller account.

it is difficult for me increase ram in aws because of my budget is low . but currently my site is working well and faster plz check site if your see any performance issue in 1 gb ram

Sat, 08/17/2019 - 10:23


It's possible to get things working with 1GB of RAM, but that's definitely considered low-memory.

There's some thoughts here on how to do that:

Sat, 08/17/2019 - 14:29

Yep, however one of the other issues that the O.P will face is hacking attempts.

With such low RAM the server has zero spare capacity to deal with such things. Once things like clamav, fail2ban, and other security software (even wordpress plugins such as wordfence) start doing their job keeping hackers out....thats when low memory systems begin to crap themselves. Any kind of little ddos attack will take out his server in a flash.

That's the other reason for a production server with client websites you can't rely on minimal memory.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

Topic locked