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

☆樱花仙子☆ 提交于 2020-01-01 06:57:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!