Error Establishing Database Connection

I’ve been having this issue since I setup this droplet roughly a month ago. I’m paying for the $10 WordPress server which should be more than capable of handing this website. It’s 10 pages are receiving virtually no traffic. I have websites on the $5 servers that are much larger and handle daily traffic fine.

I’ve installed htop and sometimes if I click around too quickly in Wordpress it causes the server to use to much ram. That’s not much of an issue. The issue is the server randomly crashing hundreds of times a day.

I don’t believe it’s my theme or my plugins. I’ve used this same theme and plugins on other websites with no problems.

Also, I followed the instruction on how to turn off XML-RPC so that won’t be the cause.

I have hundreds of these each day. /var/log/mysql/error.log:2017-07-21T14:16:46.127753Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool /var/log/mysql/error.log:2017-07-21T14:17:16.670788Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool /var/log/mysql/error.log:2017-07-21T14:17:47.151463Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool /var/log/mysql/error.log:2017-07-21T14:18:17.705673Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool

2017-07-21T20:33:11.925586Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is ``` deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-07-21T20:33:11.930052Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.19-0ubuntu0.16.04.1) starting as process 14555 … 2017-07-21T20:33:11.949845Z 0 [Note] InnoDB: PUNCH HOLE support available 2017-07-21T20:33:11.949895Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-07-21T20:33:11.949905Z 0 [Note] InnoDB: Uses event mutexes 2017-07-21T20:33:11.949911Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2017-07-21T20:33:11.949916Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8 2017-07-21T20:33:11.949937Z 0 [Note] InnoDB: Using Linux native AIO 2017-07-21T20:33:11.951436Z 0 [Note] InnoDB: Number of pools: 1 2017-07-21T20:33:11.953206Z 0 [Note] InnoDB: Using CPU crc32 instructions 2017-07-21T20:33:11.957165Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2017-07-21T20:33:11.976546Z 0 [Note] InnoDB: Completed initialization of buffer pool 2017-07-21T20:33:11.982923Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2017-07-21T20:33:12.003975Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2017-07-21T20:33:12.008146Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 262544310 2017-07-21T20:33:12.008204Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 262544319 2017-07-21T20:33:12.008216Z 0 [Note] InnoDB: Database was not shutdown normally! 2017-07-21T20:33:12.008222Z 0 [Note] InnoDB: Starting crash recovery. 2017-07-21T20:33:12.208095Z 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1” 2017-07-21T20:33:12.208142Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2017-07-21T20:33:12.208229Z 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait … 2017-07-21T20:33:12.253431Z 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB. 2017-07-21T20:33:12.254339Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2017-07-21T20:33:12.254352Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2017-07-21T20:33:12.256557Z 0 [Note] InnoDB: Waiting for purge to start 2017-07-21T20:33:12.306871Z 0 [Note] InnoDB: 5.7.19 started; log sequence number 262544319 2017-07-21T20:33:12.309148Z 0 [Note] Plugin ‘FEDERATED’ is disabled. 2017-07-21T20:33:12.309557Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2017-07-21T20:33:12.334812Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170721 20:33:12 2017-07-21T20:33:12.336702Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2017-07-21T20:33:12.336733Z 0 [Note] Server hostname (bind-address): ‘’; port: 3306 2017-07-21T20:33:12.336749Z 0 [Note] - ‘’ resolves to ‘’; 2017-07-21T20:33:12.336810Z 0 [Note] Server socket created on IP: ‘’. 2017-07-21T20:33:12.371365Z 0 [Note] Event Scheduler: Loaded 0 events 2017-07-21T20:33:12.371654Z 0 [Note] /usr/sbin/mysqld: ready for connections. engine. You may use the startup option ‘–disable-partition-engine-check’ to skip this check. 2017-07-21T20:33:12.371671Z 0 [Note] Beginning of list of non-natively partitioned tables 2017-07-21T20:33:12.423844Z 0 [Note] End of list of non-natively partitioned tables 2017-07-21T20:33:12.674749Z 3 [Note] Access denied for user ‘root’@‘localhost’ (using password: NO)

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Thank you, everyone, for the advice and suggestions. I think I’ve figured out the issue. I’m using CloudFlare CDN and SSL. This is a popular service that many people use to make their websites faster and more secure. One of the features of CloudFlare is to take snapshots of the website. If your website is ever offline, CloudFlare will serve up this snapshot. Unfortunately, CloudFlare was taking these snapshots multiple times per hour, and loading what appears to be my entire website all at the same time. This was causing the overuse of ram. Since I’ve turned that feature off I haven’t had a single crash. Hopefully, this will help other people having similar issues.

Fingers crossed that it’s fixed.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Have you tried to add swap ? Add some swap and see if fixes your problem

You have here a tutorial on how to add swap:

Hi @semipro

Can you monitor your access-log to see if your server might be attacked with massive amounts of requests. You’re only giving about 200MB to MySQL - and CentOS is probably taking another 200MB, which should give you 600MB for Apache+PHP, so you’re right, that should be enough for a typical WordPress site with low traffic. It doesn’t look like your problem is MySQL, but probably Apache+PHP - I’m not a big fan of Apache and it’s mod_php module, so my recommendation would be Nginx with PHP-FPM.