Forums

(2003, "Can't connect to MySQL server on 'mysql.server' (111)"

Im in a virtual env with 1.6 django, I've pip installed the python mysql. However, when I try:

python manage.py syncdb

Here's what I get:

File "/home/NickStefan/.virtualenvs/django16/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in init super(Connection, self).init(args, *kwargs2) django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'mysql.server' (111)") (django16)21:20 ~/swimsetswebsite/swimsetswebsite/swimsetswebsite (master)$ Console closed.

I can connect to the mysql with a console just fine. Anyone have experience with this?

additional info. I'm completely stumped. I tried python -v manage.py and I'm gettning more errors. This exact site with mysql worked on my computer, and all ive done is push it to the server and change the database settings in settings.py ... any ideas on what to try?

http://stackoverflow.com/questions/22676798/mysqldb-connection-py-cant-connect-with-django

Okay. idiot of the year award goes to me! port 3306 vs 3360 was my issue. :embarrased: thats what you get for staying up till 4am last night... Sorry everyone!

lol. We've all been there :)

Getting this error on scheduled tasks every time when trying to connect to db, the issue started yesterday. Will this be fixed tomorrow after scheduled upgrade?

I am getting this error on scheduled tasks as well, tried running it from console with no problems.... aargh

That should be fixed.

One thing you could try -- we have an experimental alternative endpoint set up for each user at a different address. If you use yourusername.mysql.pythonanywhere-services.com, then we think it will be more reliable. If anyone's willing to give that a go and let us know if it works out better, we'd be glad to hear from you.

After our system update today, the username-based hostname is now the official way to connect to your MySQL database. The old mysql.server system still works, but is now deprecated.

I'm getting this error while trying to connect to a godaddy database. Is it possible to connect to an outside database?

Not from a free account.

i am getting the following error. can somebody please help

(2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")

I see your site has got past that error now -- I'm guessing that originally you just didn't have the correct database connection parameters in your settings.py.

The problem that you have now is in your code formatting -- you're using a mixture of tabs and spacing to indent it, so you'll need to fix that in order to move forward.

I am getting this error again and again. ERROR 2003 (HY000): Can't connect to MySQL server on 'shaurov06.pythonanywhere.com' (111)

here is my database settings if you want to use my_sql

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'shaurov06$university_project',
    'USER': 'shaurov06',
    'PASSWORD': "**********",
    'HOST':"shaurov06.mysql.pythonanywhere-services.com",

}

}

when i go to university_project console, i can play with the tables within it. But can't connect it to server

Where are you seeing that error message? It doesn't look like it's appearing in your error log right now. Remember that the most recent error in the error log will be at the bottom of the file.