URGENT: Can't connect to local server through socket '/opt/bitnami/mariadb/tmp/mysql.sock'

0

Hi there, In my Lightsail-Nginx instance, MariaDB stopped suddenly sometimes and my WordPress website got the

error establishing a database connection

And when I tried to connect MariaDB on the Ubuntu console I got this error:

Can't connect to local server through socket '/opt/bitnami/mariadb/tmp/mysql.sock'

And after restarting MySQL service it's working again.

sudo /opt/bitnami/ctlscript.sh restart mysql

Thanks

asked a year ago1548 views
1 Answer
1
Accepted Answer

You need to investigate why MariaDB keeps stopping so I suggest you do the following:

  1. From my experience, this often happens when your server's resources are saturated (i.e. out of memory, max CPU, max Disk usage, throttled networking, etc.) so review instance's performance metrics to check if it flat-lining on any of the resources mentioned (CPU, disk, networking) and for memory you may follow this guide to view the memory graphs - https://aws.amazon.com/blogs/compute/monitoring-memory-usage-lightsail-instance/ More details on reviewing Lightsail performance metrics here :

  2. Review the system logs (/var/log/syslog or /var/log/messages ), mariaDB logs and or nginx logs to find out why it is stopping frequently. I would start by searching the system log file for mariadb or mysql and then reviewing the mariadb logs themselves. Both of these should give you some insight into why the service is stopping. If you are experiencing memory issues you will likely find errors like Out of memory: kill process in your system logs.

  3. If it turns out that you are exhausting your system resources, you may need to consider increasing the size of your instance to allocate more resources for your website - https://repost.aws/knowledge-center/change-lightsail-plan

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions