title: Django: Issue with SSL certificate ("SSL connection error: The message received was unexpected or badly formatted")
body: <p>I'm using Windows 10, Python 3.7.6. Using the following packages:</p>
  
  <pre><code># Name                    Version                   Build  Channel
  mysql-connector-c         6.1.11            he025d50_1002    conda-forge
  mysqlclient               1.4.6                    pypi_0    pypi
  sqlalchemy                1.3.12           py37hfa6e2cd_0    conda-forge
  sqlite                    3.30.1               hfa6e2cd_0    conda-forge
  sqlparse                  0.3.0                      py_0    conda-forge
  django                    3.0.2                    py37_0    conda-forge
  django-classy-settings    2.1.1                    pypi_0    pypi
  django-debug-toolbar      2.1                        py_0    conda-forge
  </code></pre>
  
  <p>I am using an MySQL database with the following settings. This DB was created using an IT cloud data service within my company. I downloaded the SSL certificates and placed them within my django project.</p>
  
  <pre><code> DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.mysql',
              'NAME': 'MyTestTVPVDb',
              'USER': 'MyTestTVPVDb_so',
              'PASSWORD': 'YYYYYYYYYYYYYYYYYYY',
              'HOST': 'XXXXXXXXXXXXXXXXXXXXXXX',
              'PORT': '3307',
              'OPTIONS': {
                  'ssl': {
                      'ssl-ca': os.path.join(SSL_CERT_ROOT, 'ca_cert.pem'),
                  }
              }
          }
      }
  </code></pre>
  
  <p>Now when I type <code>python manage.py dbshell</code>, I am able to connect to the DB OK and everything looks OK. I can see that the DB support SSL.</p>
  
  <pre><code>Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 476212
  Server version: 5.5.5-10.0.20-MariaDB-wsrep-log MariaDB Server, wsrep_25.10.r4144
  
  Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  
  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective
  owners.
  
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  
  mysql&gt; status
  --------------
  mysql  Ver 8.0.18 for Win64 on x86_64 (MySQL Community Server - GPL)
  
  Connection id:          476212
  Current database:       MyTestTVPVDb
  Current user:           MyTestTVPVDb_so@XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  SSL:                    Cipher in use is DHE-RSA-AES256-SHA
  Using delimiter:        ;
  Server version:         5.5.5-10.0.20-MariaDB-wsrep-log MariaDB Server, wsrep_25.10.r4144
  Protocol version:       10
  Connection:             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX via TCP/IP
  Server characterset:    utf8
  Db     characterset:    utf8
  Client characterset:    cp850
  Conn.  characterset:    cp850
  TCP port:               3307
  Uptime:                 18 days 7 hours 12 min 24 sec
  
  Threads: 35  Questions: 1394611  Slow queries: 268  Opens: 87  Flush tables: 1  Open tables: 96  Queries per second avg: 0.882
  </code></pre>
  
  <p>However, when I type <code>python manage.py runserver</code> to start the server, I get the following exception that I don't know how to resolve.</p>
  
  <pre><code>INFO Watching for file changes with StatReloader
  Performing system checks...
  
  Exception in thread django-main-thread:
  Traceback (most recent call last):
    File "C:\Anaconda3\lib\site-packages\django\db\backends\base\base.py", line 220, in ensure_connection
      self.connect()
    File "C:\Anaconda3\lib\site-packages\django\utils\asyncio.py", line 26, in inner
      return func(*args, **kwargs)
    File "C:\Anaconda3\lib\site-packages\django\db\backends\base\base.py", line 197, in connect
      self.connection = self.get_new_connection(conn_params)
    File "C:\Anaconda3\lib\site-packages\django\utils\asyncio.py", line 26, in inner
      return func(*args, **kwargs)
    File "C:\Anaconda3\lib\site-packages\django\db\backends\mysql\base.py", line 233, in get_new_connection
      return Database.connect(**conn_params)
    File "C:\Anaconda3\lib\site-packages\MySQLdb\__init__.py", line 84, in Connect
      return Connection(*args, **kwargs)
    File "C:\Anaconda3\lib\site-packages\MySQLdb\connections.py", line 179, in __init__
      super(Connection, self).__init__(*args, **kwargs2)
  MySQLdb._exceptions.OperationalError: (2026, 'SSL connection error: The message received was unexpected or badly formatted')
  </code></pre>
  
  <p>If I downgrade the <code>mysqlclient</code> package to v1.3.14 from v1.4.6, the server starts OK.</p>
  
  <pre><code>(base) C:\Users\XXXX\Desktop\PyCharmProjects\personal-work-repo\python\src\tvpv_portal&gt;conda list mysql
  # packages in environment at C:\Anaconda3:
  #
  # Name                    Version                   Build  Channel
  mysql-connector-c         6.1.11            he025d50_1002    conda-forge
  mysqlclient               1.3.14           py37he774522_0    defaults
  
  (base) C:\Users\XXXX\Desktop\PyCharmProjects\personal-work-repo\python\src\tvpv_portal&gt;python manage.py runserver
  INFO Watching for file changes with StatReloader
  Performing system checks...
  
  System check identified no issues (0 silenced).
  January 03, 2020 - 02:55:23
  Django version 3.0.2, using settings 'tvpv_portal.settings'
  Starting development server at http://127.0.0.1:8000/
  Quit the server with CTRL-BREAK.
  </code></pre>
  
  <p>Any ideas what is going wrong here? Is it some problem with the SSL certificate?</p>