Search code examples
mysqldjangoamazon-web-servicesamazon-ec2bitnami

how to fix (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") on ec2 bitnami?


I am working on ec2 bitnami with python django on AWS. I am encountering (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") while fetching objects from mysql database.

I have been gone through so many forums still I am not getting what is it exactly and why this problem being arisen. Please tell me what is it and how to fix it for python django mysql on ec2 bitnami.

Thanks in advance.


Solution

  • Set the HOST to

    127.0.0.1

    in settings.py and make sure MySQL server is running.