所以,我使用OpenShift Django的快速啓動,與MySQL 5.1和phpMyAdmin安裝4.0。我已經建立了一個數據庫,並且遵循了一個教程來解決這個錯誤。當我做「蟒蛇manage.py執行syncdb」,以下出現:的Python - Django的Manage.py執行syncdb失敗?
python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/base.py", line 231, in execute
self.validate()
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/management/validation.py", line 103, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/db/backends/mysql/base.py", line 411, in get_server_version
self.cursor()
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/db/backends/__init__.py", line 308, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/var/lib/openshift/526c6afd50044654c4000145/python/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/db/backends/mysql/base.py", line 387, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")
任何人有任何想法是怎麼回事?我試圖創建一個新的項目,並按照相同的指示,但結果是一樣的。
你的settings.py文件沒有正確DATABASES設置您連接到您的本地MySQL服務器 – sdolan
謝謝!在phpMyAdmin,我創建了一個用戶與本地主機的主機,沒有工作,所以我嘗試了用戶與此主機的主機,以及複製的IP,它的工作! – user238055