Bug #94226 Unable to connect to database using applicatio server
Submitted: 6 Feb 2019 16:58 Modified: 13 Aug 2020 11:31
Reporter: Hrvoje Mlinaric Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:8.0.14 OS:Debian
Assigned to: CPU Architecture:x86

[6 Feb 2019 16:58] Hrvoje Mlinaric
Description:
Here you have hello world example for flask and mysql. 

import mysql.connector
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
    cnx = mysql.connector.connect(user='scott', password='password',
                              host='127.0.0.1',
                              database='employees')
    return 'Hello, World!'
    

Everything works fine running this example with python or with flask command.
If I deploy this example on application server running nginx, uwsgi and flask (for example in docker container https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask) I'm getting this error:  2026 (HY000): SSL connection error: SSL_CTX_new failed
Workaround for this is to set use_pure=True and use C++ API.

But when I open connection with use_pure=True, and execute with python, flask, application server this line of code:

cursor.callproc(name, [""])

I'm getting this error: "bytearray index out of range"  

cursor.callproc(name, ["test"])
cursor.callproc(name, [None])

Works without problems.

How to repeat:
Tray the about code in the docker container  https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask. You have full instruction on that pages

Suggested fix:
The error "2026 (HY000): SSL connection error: SSL_CTX_new failed" looks to me like that connector is trying to connect using the certificate.
Is it possible to force the connection to use username and password?
[23 Jul 2019 10:00] Jonathan Liu
Are there any updates to this issue? 

We are facing a similar problem in our environment. 

Thank you. 

Details:
Connector/C++
8.0.15
[13 Jul 2020 11:31] MySQL Verification Team
Please try version 8.0.21. Thanks.
[14 Aug 2020 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".