Report this

What is the reason for this report?

Error establishing a database connection wordpress

Posted on July 21, 2017

I running a wordpress website in 512 MB Memory / 20 GB Disk /Ubuntu LAMP on 14.04,everything working fine for 2 weeks,then suddenly appear Error establishing a database connection this is what I try to solve this problem

  1. increase server size to 1GB memory,still the same
  2. increase swap,still cant solve

Now I cant even go in phpmyadmin,it show #2002 Cannot log in to the MySQL server in my phpmyadmin page even my username and password is correct.

Please suggest me a solution to solve this,cause I really dont want to configure the whole server and build the site all over again.



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!

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.

I noticed a large number of requests coming to my site. Looking at the log file located at /var/log/apache2/access.log I noticed a large number of requests each second to /xmlrpc.php.

This causes the server to run out of memory pretty quickly and the mysql service eventually either fails or is restarted for some reason.

Maybe the same thing is happening to you.

If that’s your case look at: https://www.digitalocean.com/community/tutorials/how-to-protect-wordpress-from-xml-rpc-attacks-on-ubuntu-14-04

I am having a similar problem. This is what my log file shows:

2017-07-22T15:26:09.153240Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8 2017-07-22T15:26:09.153247Z 0 [Note] InnoDB: Using Linux native AIO 2017-07-22T15:26:09.155154Z 0 [Note] InnoDB: Number of pools: 1 2017-07-22T15:26:09.157889Z 0 [Note] InnoDB: Using CPU crc32 instructions 2017-07-22T15:26:09.165356Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2017-07-22T15:26:09.165839Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12 2017-07-22T15:26:09.165857Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2017-07-22T15:26:09.165870Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2017-07-22T15:26:09.165884Z 0 [ERROR] Plugin ‘InnoDB’ init function returned error. 2017-07-22T15:26:09.165891Z 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed. 2017-07-22T15:26:09.165916Z 0 [ERROR] Failed to initialize plugins. 2017-07-22T15:26:09.165920Z 0 [ERROR] Aborting

2017-07-22T15:26:09.165937Z 0 [Note] Binlog end 2017-07-22T15:26:09.167271Z 0 [Note] Shutting down plugin ‘MyISAM’ 2017-07-22T15:26:09.167486Z 0 [Note] Shutting down plugin ‘CSV’ 2017-07-22T15:26:09.168462Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

@matchartproduction

It is probably memory issue, try to increase the RAM for the droplet.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.