Forums

Connecting MySQL to Django Project

Hi.

I am trying to connect my MySql Database for pythonanywhere to my Django Application (On my local virtual machine before pushing the code to pythonanywhere ). But i am unable to do that ... getting some error.

 DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'username$Database,
        'USER': 'username',
        'PASSWORD': 'usernamepw',
        'HOST': 'user.mysql.pythonanywhere-services.com',
    }
}

What i am doing wrong.

What error are you getting?

2003, "Can't connect to MySQL server on 'vasilovm.mysql.pythonanywhere-services.com' (10060)")

We do not expose our users' databases to the internet. You can, however, use an SSH tunnel to connect to your database: https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere/