0

I have hosted a MySQL DB on AWS EC2 instance(t2.micro, ubuntu, free tier). I am able to connect to it and store data. But most of the time, I am unable to connect to it via workbench or my app. But my configurations are correct since I am able to connect to it sometime and store values. The workbench throws the following error: Lost connection to MySQL server at 'reading initial communication packet', system error: 104.

The app throws an ETIMEDOUT error.

What's wrong here? I have checked Cloudwatch metrics also, but there is no warning on CPU out of credits also. This issue persists continuously for days now(between I am able to connect to the DB randomly). and no useful info about it anywhere.

I am trying to connect via my local machine. And the app is hosted in Vercel.

Nithur
  • 1

1 Answers1

0

With the limited information provided from your EC2 server,

Observations, Connections were 895 Aborted_connects were 357 for your uptime of the instance.

To attempt to reduce connect failures, consider for your EC2 Parameters Group,

net_read_timeout=60  # from 30 seconds for more patience to complete task
connect_timeout=30  # from 10 seconds for more patience to complete task
mysqlx_read_timeout-60  # from 30 seconds just in case. 

Things we do not know that might influence your timing, the availability zone where your EC2 is running and what is your physical zone? If a REPLICA is involved, where is the availability zone for the REPLICA?

These suggestions are for your EC2 instance.

Good luck, for additional assistance view profile for contact info and free Utility Scripts to improve server query completion speed.

Wilson Hauck
  • 426
  • 4
  • 10