问题
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.
回答1:
Set the HOST
to
127.0.0.1
in settings.py
and make sure MySQL server is running.
回答2:
In a BitNami AMI the MySQL socket is /opt/bitnami/mysql/tmp/mysql.sock
Check the official BitNami documentation here: http://wiki.bitnami.org/Components/MySQL#What_is_the_default_configuration.3f
You should change the HOST
setting accordingly in your settings file:
https://docs.djangoproject.com/en/1.3/ref/settings/#host
来源:https://stackoverflow.com/questions/13412805/how-to-fix-2002-cant-connect-to-local-mysql-server-through-socket-tmp-mysq