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 年前1244 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则