All we need is an easy explanation of the problem, so here it is.
I get occasional error establishing database connection error on WP site. It happens regularly. To prevent it from happening again, I need to fix it, after the error I checked MySQL error logs and they are something like this
I AM READY TO PROVIDE MORE DETAILS IF NEEDED
[ERROR] mmap(137363456 bytes) failed; errno 12
[ERROR] Cannot allocate memory for the buffer pool
[ERROR] Plugin initialization aborted with error Generic error
[ERROR] Failed to initialize DD Storage Engine
[ERROR] Data Dictionary initialization failed
[ERROR] Aborting
How do I know what causes it and how can I fix it?
This happens when I am not around. If 3-4 days go without signing in, it happens automatically. Then I have to restart the server to get back website working again. ↑ Those are errors I get in mysql error logs.
The website is live and database is working, but this error happens if I am not around and can’t restart the server.
Information that should help you find out what is causing the crash:
usr/sbin/mysqld (mysqld 8.0.19) starting as process 4892
Starting XA crash recovery...
XA crash recovery finished.
CA certificate ca.pem is self signed.
X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
usr/sbin/mysqld (mysqld 8.0.19) starting as process 5033
mmap(138353436 bytes) failed; errno 12
Cannot allocate memory for the buffer pool
Plugin initialization aborted with error Generic error
Failed to initialize DD Storage Engine
Data Dictionary initialization failed
Aborting
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
Method 1
Plan A: Get more RAM.
Plan B: Remove some other apps.
Plan C: Decrease a setting: innodb_buffer_pool_size = 100M
and hope that it saves enough room without slowing down WP too much.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0