My VM not connecting to MySQL – 2002 error

I’m currently experiencing issues with my virtual machine named "monitoramentoati". When trying to access my application through the domain https://monitoramentoati.camf.org.br/admin/login/, I encounter the following error from Django:

"OperationalError at /admin/login/ (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)")"

The full traceback points to an issue with the Django application being unable to connect to the local MySQL server via socket. However, when I check the MariaDB service inside the VM, it shows as active (running) and the socket being used is:

"/run/mysqld/mysqld.sock"

This differs from the path Django is trying to use (/var/run/mysqld/mysqld.sock), which may indicate a misconfiguration or a linking issue in the filesystem.

Additionally, I’m seeing logs like the following in the system log viewer (Cloud Logging):

"May 14 15:43:56 monitoramento-ati gunicorn[915]: django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)")"

I was wondering if you could help me with this problem. What should I do?

I tried to update the mysql, django and everything that I can and did't work.

Вернуться на верх