Abdo
By:
Abdo

help, my website allows closed cannot hold 2 users, error establishing a database connection, my website is down lost all users, help.

April 24, 2017 1.3k views
DigitalOcean WordPress Apache Ubuntu 16.04

I am running ubuntu 16.04. with lamp 1 click install. I made before a month a good. It was working perfectly. But now if even I test my website page speed by any page speed tools I get the error.
error establishing a database connection, really it is a problem. I did not find a solution to it.
The problem it was working fine.
I found error by utf firewall , I cannot remember the name but I disable it.
I have many errors that cannot disappear.

[Warning] Changed limits: max_open_files: 1024 (requested 5000)

 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

[ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
 [ERROR] Plugin 'InnoDB' init function returned error.
 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
 [ERROR] Failed to initialize plugins.
[ERROR] Aborting

Please help. If you face this problem please help:

13 Answers

@Abdo

InnoDB: Cannot allocate memory for the buffer pool

The above is normally a sign that you're using all the available RAM on your Droplet, which means that you'd need to optimize (tweak/tune) your MySQL installation for your particular needs or upgrade the Droplet so that you have more RAM available.

If this is a 512MB Droplet, for example, you really don't have much to work with and said RAM can become exhausted rather quickly unless you're familiar with ways that you can better optimize your stack (Apache/NGINX, MySQL/MariaDB, PHP, etc).

It's not impossible to run a single installation on a 512MB Droplet, though it's not super-easy without making some modifications.

I am running mysql version
5.7.17
Do you know that I am a lone in the website.
My website was working fine perfectly.
Which can hold even 100 users at the same time.
But when I upload wordfence WordPress. This plugin destroyed my website.
No: jtittle
Changed limits: maxopenfiles: 1024 (requested 5000)
Changed limits: tableopencache: 431 (requested 2000)
I just need to change these values.
And then I can upgrade, I hope to fix this issue.

When you told me upgrade, does the upgrade change these values.
Changed limits: maxopenfiles: 1024 (requested 5000)
Changed limits: tableopencache: 431 (requested 2000)

  • @Abdo

    By upgrade, I mean upgrade the size of your Droplet.

    For example, if you deployed a Droplet with 512MB of RAM, you may need to upgrade to 1GB or even 2GB. I normally recommend starting with 1GB if you're going to be running sites that are database-driven.

    The error:

    InnoDB: Cannot allocate memory for the buffer pool
    

    Says you're running out of RAM.

I am sorry for saying. but people should start from the first.
We have to imagine that you are right.
And this one
[Warning] Changed limits: maxopenfiles: 1024
I followed all the tutorials, I want to change it.
Imagine 2 users the website closed.
If you want to help me even with money.
I just to delete this error.
I installed lamp one click.
I can upgrade but it is not logical this one
[Warning] Changed limits: maxopenfiles: 1024
with be upgraded with it.

@jtittle
help. I followed millions of tutorials, just now it is 5.26 am, trying to do it tell this time.
I followed tutorials people do it and change it. but for me, my website desroyed and closed and delete the droplet and create one new.
I just need help to delete this error, or start from the first up. directly to the last one??????????????

@Abdo

I'm not sure what tutorials you followed, though the biggest issue with most is that they aren't always accurate. When you start tinkering with the configuration, you need to know what you're doing which is where most tutorials fail. The ones at DigitalOcean are pretty in-depth when it comes to setup and configuration, but that's not always the case elsewhere.

Without really knowing what you've changed as a result of the guides you've followed, it's hard to really make a suggestion that would be helpful -- more so because I can't see what's going on (i.e. I don't have access to your Droplet).

If you want a sysadmin to take a look at it for you, I can. My e-mail is in my profile, just click on my username. What I'd charge to go over the configuration and fix the issue(s) depends on what I'm looking at. I'd have to see what's going on and get more information. Shoot me an e-mail and we can chat further.

@Abdo

There is a very big difference between a warning and an error.
Warnings can be ignored. Errors means something does not work.

You need more RAM, so upgrade your droplet to the next step - like @jtittle already wrote.

And it is highly recommended not to do system administration work at 5am, since we (humans) tend to make even more mistakes and overlook things.

No. if i upgrade what will happen
and why they limmited my droplet to just 2 users.
and the said 1 tb of bandwidth.

  • @Abdo

    If you upgrade, then you will have more RAM. Currently you are running out of RAM, which is why your database is crashing.

    There is no limit on your droplet besides which one you purchase - but there is a limit of what you can do with 512MB RAM and still trying to run heavy systems like WordPress with MySQL.

    I would recommend that you switch from DigitalOcean to a managed hosting provider like SiteGround, since you don't need to know anything about RAM, CPU, etc to have your WordPress site there.

@hansen

I love digitalocean I want my website in here, I hate other hosting. I started here. my dream is to host here.
Ok when I change ram.
Does [Warning] Changed limits: maxopenfiles: 1024 (requested 5000)

[Warning] Changed limits: tableopencache: 431 (requested 2000)
disappear.
My problem is just these two errors. And I am still making my website I did not finish it. After I finish I can upgrade because I must upgrade and I know 0.5 ram is nothing.
But I just want to change the
Changed limits: maxopenfiles: 1024
because I really hate just 4 errors and they are repeated million time in mysql error folder.

  • @Abdo

    I highly doubt you have 5000 or 1024 or even 431 tables in all your databases.
    You have wrong configuration of MySQL.
    And again, it's not errors - it's warnings. So they can be ignored.

    I would recommend that you either reset to original configuration or run MySQL Tuner to get hints on configs:
    https://github.com/major/MySQLTuner-perl

@hansen I upgraded my droplet.
i created high droplet.
for test. why when I type
ulimit -a
I found open files (-n) 1024
I am downloading lamp by digitalocean ocean. Why they allow such these configurations.
Paying 100$ for advertisements and my website can not hold 1 user.
Please help. hansen.
And even you please type
ulimit -a
and see the open files. because I did everything I saw all th tutorials in external sites.
But My website stop working when I try to change this.

Installing lamp by default you find this configuration.
Installing phpmyadmin 1 click I find this configuration.

  • @Abdo

    The ulimit open files = 1024 doesn't really matter in your case.
    I have multiple servers with the exact same setting and they can easily handle several hundred connections (several million page views per month).

    If you select LAMP or LEMP one-click-app, then it should be able to handle 50+ connections at the same time. But with a heavy WordPress, this number might be only 5-10 connections on a $10 droplet.

    But if you want speed, then don't use Apache (LAMP) - use Nginx (LEMP).
    And instead of MySQL, use MariaDB. And use PHP7.1
    And you need to tune and tweak every single one of them to get the optimal performance.

@hansen These are the difault configration just install new droplet and see by yourself.
This problem. If 5 users open my website. I get error establishing database.

@hansen
Thank you, but really a problem. Look, In the 5$ droplet. when I get error establishing database connection. and after 10 second it works fine.
But when I upgrade to 10$ I when I get this error. It cannot be changed until I make restart mysql.
...................
Thank you for your solution.
could you please help me.
just by writing 1 paragraph. I have a wordpress website. working on lamp droplet.
You mean. I move the folders to my computer then from my computer to the new lemp droplet.
then it works ok. please advice.

  • @Abdo

    When you were on the $5 droplet, MySQL ran out of RAM and closed, so it would have required manual restart.
    If you are facing the same problem on a $10 droplet, then you need more RAM, so upgrade to the next step.
    But this just underlines that you have a major problem in your WordPress installation, since it's sucking up more than 1GB RAM, which is very unusual for a small blog, but very common if you have a webshop or other heavy systems.

    You need to test without WordPress or with a default installation of WordPress (to make sure it's not a problem with a theme or plugin).

    Again, it's not easy to manage MySQL on low-RAM systems. It requires that you change the configuration.

@hansen you mean I have to install lemp manually.

Have another answer? Share your knowledge.