Forums

Django migration Sqlit3 to MySql

Hello PythonAnywhere, I'm looking to migrate my current database to MySql for performance reasons, but I keep getting some errors in the bash console. I changed this in settings.py

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'username$database_name',
    'USER': 'username',
    'PASSWORD': 'mysql_password',
    'HOST': 'mysql_hostname',
}

Then I ran:

python manage.py dumpdata > datadump.json

Then:

python manage.py migrate --run-syncdb

Then:

python manage.py loaddata datadump.json

which gives me the following error:

django.db.utils.ProgrammingError: (1146, "Table 'hradutiu$default.django_session' doesn't exist")

Any ideas what I did wrong, have I missed a step in migrating from sqlite to mysql? Any help would be appreciated, you have my permission to look into the files if that could help you in finding a solution. Thank you very much!

Got it to work, I dropped all tables and started from scratch. Now it works.

ah great!

I am having this error: "django.db.utils.OperationalError: (1045, "Access denied for user 'xyz@'10.0.0.117' (using password: YES)")"

how can I make this work? I have checked password and all the details ten times now.

Where are you getting that error? That is, is it in a console, the error log for a website, or somewhere else?