Django server not starting correctly seems to be a mysql issue.

巧了我就是萌 提交于 2019-12-13 19:38:53

问题


I'm trying to start a django server and I'm getting an error I don't understand.

This is the error at the bottom of the terminal output:

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

This: Error Loading MySQLdb Module and "pip install MySQLdb"

Is a question I asked earlier that gives some background.

I'm really new to Django and python and I saw this: mysql ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1) But I wasn't sure how to implement what it suggests.

Here is the full error:

    Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x101c358c0>
Traceback (most recent call last):
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper
    fn(*args, **kwargs)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 114, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/core/management/base.py", line 469, in validate
    return self.check(app_configs=app_configs, display_num_errors=display_num_errors)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/core/management/base.py", line 482, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 28, in check_all_models
    errors.extend(model.check(**kwargs))
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/base.py", line 1205, in check
    errors.extend(cls._check_fields(**kwargs))
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/base.py", line 1282, in _check_fields
    errors.extend(field.check(**kwargs))
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 934, in check
    errors = super(AutoField, self).check(**kwargs)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 207, in check
    errors.extend(self._check_backend_specific_checks(**kwargs))
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 306, in _check_backend_specific_checks
    return connection.validation.check_field(self, **kwargs)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/mysql/validation.py", line 18, in check_field
    field_type = field.db_type(connection)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 614, in db_type
    return connection.data_types[self.get_internal_type()] % data
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/utils/functional.py", line 59, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 196, in data_types
    if self.features.supports_microsecond_precision:
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/utils/functional.py", line 59, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/mysql/features.py", line 52, in supports_microsecond_precision
    return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/utils/functional.py", line 59, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 371, in mysql_version
    with self.temporary_connection():
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 462, in temporary_connection
    cursor = self.cursor()
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 276, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/Users/Bren/Desktop/fss/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')

回答1:


I reverted my MySql to 5.6.27. Then it worked.



来源:https://stackoverflow.com/questions/34033107/django-server-not-starting-correctly-seems-to-be-a-mysql-issue

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