Error establishing a database connection – MySQL is not running and cannot be started

Keywords: WordPress - AWS - Technical issue - Connectivity (SSH/FTP)
I have a website that has been running on Amazon Lightsail for around a year.
Currently located here:
I haven’t updated it in a few months, but a few days ago it started showing an ‘Error establishing a database connection’ error on a lot of pages.

I did done some digging, and have tried to access the mysql but it doesn’t seem to be running. Status shows:
php-fpm already running
apache already running
mysql not running

Trying to start or restart mysql gets the error:
Unmonitored mysql
/opt/bitnami/mysql/scripts/ : mysql not running
/opt/bitnami/mysql/scripts/ : mysql could not be started

I don’t seem to be out of storage:

Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 799M 8.8M 790M 2% /run
/dev/xvda1 156G 22G 134G 15% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 56M 56M 0 100% /snap/core18/1997
/dev/loop1 100M 100M 0 100% /snap/core/10958
/dev/loop2 33M 33M 0 100% /snap/amazon-ssm-agent/2996
/dev/loop3 56M 56M 0 100% /snap/core18/1988
/dev/loop4 100M 100M 0 100% /snap/core/10908
/dev/loop5 34M 34M 0 100% /snap/amazon-ssm-agent/3552
tmpfs 799M 0 799M 0% /run/user/1000

I’m not sure what else to try, but really need to get this website back online for my client. Any ideas?

Thanks in advance.

Hello @elle,

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.

Hi David,

Thanks so much for your quick response. My code ID is de50b5fb-fc45-1b0b-706e-22d113d577ab


Hi @elle,

Did you remove the MySQL binlog file? I found the next error message in the logs

2021-04-29T04:19:16.096370Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld.bin (mysqld 8.0.18) starting as process 12836
mysqld.bin: File './binlog.008180' not found (OS errno 2 - No such file or directory)
2021-04-29T04:19:16.673603Z 0 [ERROR] [MY-010958] [Server] Could not open log file.
2021-04-29T04:19:16.673769Z 0 [ERROR] [MY-010041] [Server] Can't init tc log
2021-04-29T04:19:16.673989Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-04-29T04:19:17.913142Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld.bin: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

Can you check the next thread in the forum for a similar error?

Hi Gongomgra,

I didn’t delete any binlog files (not even sure what these are) but I followed these steps and it is working again :slight_smile: Thank you so much!

Is there anything I need to know to prevent this happening in future?

Hi @elle,

We are glad it worked for you. It is weird and usually related to the accidental removal of the binlog files. If you face the problem again please let us know so we can try to find out a possible root cause.