Forums

not able to connect MySQL on server

i added DB credentials into .env file but i'm getting this error while trying to connect https://screenrec.com/share/apzlRZMQmo django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

getting above mentioned error

It sounds like it's not picking up the .env file, and is trying to make the default MySQL connection to a server running on the local machine.

What do you have in the .env file? You can paste it here, but of course you should replace any passwords with something like "XXXXX".

Also, what code do you have to load the contents of the .env file?

in .env file, i'm having this .env1 by following this link : https://help.pythonanywhere.com/pages/environment-variables-for-web-app right now my wsgi file looks like this: wsgi2

Looks like the directory you are setting in the wsgi file is not correct. ../ in the project_folder seems to be pointing outside your home directory.