Reputation: 684
I'm running Django 1.6 with MySQL on pythonanywhere.com. In the bash command line:
$ mysql -h $your_IP =P 3306 -u username -p
However, when I try and run python manage.py syncdb I get an error that ends with this:
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'mysql.server' (111)")
In my django settings I have
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydatabasename',
'USER': 'myusername',
'PASSWORD': 'mypassword',
'HOST': 'mysql.server',
'PORT': '3360',
}
}
I tried running python manage.py test and python manage.py testserver
and got the exact same error. I tried python -v manage.py etc to get the verbose spit out and it seems a lot of other stuff is failing to import? Could it be that the settings.py isnt being found? The whole set up worked perfectly fine local, and all I've done is push it to the server and changed the database settings.
Any idea???
Upvotes: 2
Views: 1336
Reputation: 99660
Your settings read port as 'PORT': '3360',
change that to 3306
. Also, make sure mysql.server
is a valid server host. Or it could just be localhost
Upvotes: 3