Error establishing a database connection AWS

Keywords: WordPress - AWS - Technical issue - Other
Hello, I have Wordpress on AWS, I was browsing the site and it got really slow, then it crashed, restarted the EC2 instance and when I return it shows error “Error establishing a database connection”

1- I can enter Phpmyadmin
2- I haven’t changed anything in Wpconfig
3- I added the define line (‘WP_ALLOW_REPAIR’, true); and I tried to repair it but after a while of error 504 Gateway Timeout

I don’t know what could have happened, nothing different was done.

I count on your help thanks. =)

Hi @curileite,

Are all the services running in the instance?

sudo /opt/bitnami/ status

You can try to start them with the start command: sudo /opt/bitnami/ start

We have a Support Tool that will gather relevant information for us to analyze your configuration and logs. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

Please note that you need to paste the code ID that is shown at the end.

Hello good morning, I just discovered the problem, something caused the HD to be 100% full on the server, locking it in general, I don’t know where this file is but I will look for it.

Hi I read a tutorial and I managed to increase the disk space, I doubled the size and the space problem was solved, but I still keep getting a connection error with the database, did I forget to do something?

Follow the support code =)

thank you.

Hello friend, look I managed to solve the problem.

Everything happened for a reason, the HD was suddenly full, even after freeing up space on the Cloud I realized that the wp_options table was corrupted, I restored the table and everything worked fine.

But one thing that I was intrigued about is the reason that from one moment to the next to increase the use of the file on the server, since my site does not have access it is in stand-by test.

Hi @curileite.

I’m glad to hear you managed to solve the issue. Regarding this doubt you have, you can run these commands to obtain the list of folders with more data inside the installation directory

cd /opt/bitnami
sudo du -h . -d 1 | sort -h

The Bitnami support tool showed that there are some binlog files in the MySQL’s folder that is taking most of that space

total 5358628
drwxr-x---  7 mysql root        4096 Jul 27 14:44 .
drwxr-xr-x 11 root  root        4096 Jul 16 15:27 ..
-rw-r-----  1 mysql root          56 Jul  6 20:57 auto.cnf
-rw-r-----  1 mysql mysql 1073757795 Jul 22 05:20 binlog.000005
-rw-r-----  1 mysql mysql 1073760846 Jul 24 17:55 binlog.000006
-rw-r-----  1 mysql mysql 1073745863 Jul 25 06:05 binlog.000007
-rw-r-----  1 mysql mysql 1073750761 Jul 25 16:36 binlog.000008
-rw-r-----  1 mysql mysql 1005775224 Jul 26 13:06 binlog.000009

The binlog files store all the actions that are performed in the database and helps you recover the database if something goes wrong. You can disable the files if you want and generate snapshots of the instance from time to time to be able to recover the application if you lose any data.

We also suggest you take a look at this WordPress plugin that helps you optimize the database information

Happy to help!

Was my answer helpful? Click on :heart:

Hello Are you okay?

The Mysql folder is really huge, strange that my database doesn’t even have 30MB, as for the binlog I can’t access the folder to delete the files, it always returns a permission error to access the data folder, you know if there is another way to to delete these files?
Thank you!

Hi @curileite,

You shouldn’t remove those files, that can break the database. You should disable the binary logging in the database and purge the logs. This other post has all the information

Happy to help!

Was my answer helpful? Click on :heart:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.