Django AWS RDS MySQL Error: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')

[亡魂溺海] 提交于 2019-12-10 10:33:49

问题


I'm having some trouble connecting to my AWS RDS Database from my Python/Django application. I'm getting this error when trying to run my application locally:

django.db.utils.OperationalError: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')

I couldn't find any answers online as I am not trying to connect via SSL.

My Database settings in settings.py is straightforward:

DATABASES = {
     'default': {
       'ENGINE': 'django.db.backends.mysql',
       'NAME': '<my db name>',
       'USER': '<my username>',
       'PASSWORD': '<my password>',
       'HOST': '<my aws host>',
       'PORT': '<my port>',
     }
}

I was getting the same error trying to access the MySQL RDS via terminal, but was able to resolve that error by adding --skip-ssl to the end of the command. I've looked around but haven't yet found a way to implement that same fix with my Django application.

This is my first time working with Python, Django and AWS (and also posting a question on stack overflow) so I apologize in advance if my terminology is off. Thank you in advance for any help you can provide.


回答1:


did you try

DATABASES = {
     'default': {
       'ENGINE': 'django.db.backends.mysql',
       'NAME': '<my db name>',
       'USER': '<my username>',
       'PASSWORD': '<my password>',
       'HOST': '<my aws host>',
       'PORT': '<my port>',
       'OPTIONS': {
            'skip-ssl',
       },
    }
}


来源:https://stackoverflow.com/questions/33980751/django-aws-rds-mysql-error-2026-ssl-connection-error-error00000001lib0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!