search

Home  >  Q&A  >  body text

Solve the problem of operation error when pythonanywhere connects to MySQL database

I have finished my django project and I want to test it on PythonAnywhere, everything is fine until the mysql database connection shows an error

I have paid for a subscription.

/home/ An operation error occurred (1044, "Access to database 'almx98' for user 'almx98'@'%' is denied")

I have a lot of records that I don't want to lose.

pythonanywhere venv settings.py:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'almx98',
    'HOST': 'almx98.mysql.pythonanywhere-services.com',
    'PORT': '3306',
    'USER': 'almx98',
    'PASSWORD': config('DB_PASSWORD'),
}

}

Server connection settings:

P粉459440991P粉459440991231 days ago519

reply all(1)I'll reply

  • P粉938936304

    P粉9389363042024-04-01 18:11:28

    MySQL database names on PythonAnywhere have the format: <username>$<something> Your default database name looks like this: almx98$default But you may already Created additional database names to be used in the web application. < /p>

    reply
    0
  • Cancelreply