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

已提問 1 年前檢視次數 1247 次
1 個回答
1
已接受的答案

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
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南