Skip to content Skip to sidebar Skip to footer

Error During Django "running Migrations": Django.db.utils.operationalerror: (2013, 'lost Connection To Mysql Server During Query')

My Django project is connect to the remote MySQL database. After I created all the model classes in Django, I tried python manage.py makemigrations Everything is fine. Then I ente

Solution 1:

Please do this : 1- Install new fresh of mySQL server first. 2- Create new db 3- Config in django settings like this :

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'db_name',
    'USER': 'root',
    'PASSWORD': 'db_pass',
    'HOST': 'localhost',   # Or an IP Address that your DB is hosted on'PORT': '3306',
    'OPTIONS': {"init_command": "SET storage_engine=MyISAM"},
}

4- Re-run syncdb 5- Re-run migrate I hope this work

Post a Comment for "Error During Django "running Migrations": Django.db.utils.operationalerror: (2013, 'lost Connection To Mysql Server During Query')"