Pythonanywhere MySQL connection
Question: I'm new to pythonanywhere and am currently deploying my first app with it and
the bottle framework. I have created a db with the online console but I don't
know the syntax for accessing it. Is it the same syntax as when deploying
locally? Or is it something else? MySQLdb has been imported... Thanks for any
help.


Answer: Here is [page on using MySQL at
PythonAnywhere](https://www.pythonanywhere.com/wiki/UsingMySQL). It suggests
to use the following configuration for django:

    
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': '<your_username>$<your_database_name>',
            'USER': '<your_username>',
            'PASSWORD': '<your_mysql_password>',
            'HOST': 'mysql.server',
        }
    }
    

And I'm almost entirely sure that these credentials will be acceped by
[MySQLdb driver](http://mysql-python.sourceforge.net/MySQLdb.html):

    
    
    db=MySQLdb.connect(
        host='mysql.server',
        user='<your_username>',
        passwd='<your_mysql_password>',
        db='<your_username>$<your_database_name>')
    

