Python Forum

Full Version: Flask web app MySQL runtime error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Python Community

I'm following a tutorial about a Flask web app and trying to connect to MySQL to display a data list (SELECT ...) when I get this error in runtime when I navigate to the html page. I paste the error text and then the code which tries to connect to the DB.

Error:
MySQLdb.OperationalError MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') Traceback (most recent call last) File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1498, in __call__ return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1476, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\PABLO\Desktop\sisclientes\main.py", line 24, in index_clientes conexion = mysql.connection ^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 109, in connection ctx.mysql_db = self.connect ^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 97, in connect return MySQLdb.connect(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\__init__.py", line 121, in Connect return Connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\connections.py", line 195, in __init__ super().__init__(*args, **kwargs2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object
from flask import Flask, render_template
from flask_mysqldb import MySQL

app = Flask(__name__)

mysql = MySQL()

app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_PORT'] = 3306
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'Clientes'
app.config['CURSORCLASS'] = 'DictCursor'
mysql.init_app(app)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/clientes')
def index_clientes():

    sql = "SELECT * FROM Clientes"
    conexion = mysql.connection
    cursor = conexion.cursor()
    cursor.execute(sql)
    clientes = cursor.fetchall()
    conexion.commit()
    return render_template('modulos/clientes/index.html', clientes=clientes)

@app.route('/clientes/create')
def create():
    return render_template('/modulos/clientes/create.html')

if __name__ == '__main__':
    app.run(debug=True)
The DB is created in XAMPP.
Any help will be appreciated. Thank you.
Pablo
Error you're encountering indicates that your MySQL client is attempting to establish an SSL/TLS connection to the MySQL server,
but the server does not support SSL/TLS connections.
This is a common issue when using the MySQLdb connector with newer versions of MySQL clients, where SSL is required by default.
Add this line:
app.config['MYSQL_SSL_DISABLED'] = True

Quote:The DB is created in XAMPP
XAMPP is not need,and add just old complicity not needed all in Python.

Flask-SQLAlchemy is better choice and can connect MySQL through it.
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

# Database configuration
# pip install mysql-connector-python
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:root@localhost:3306/Clientes'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

# Disable SSL
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
    'connect_args': {
        'ssl': {'ssl_disabled': True}
    }
}

db = SQLAlchemy(app)

# Define your model
class Cliente(db.Model):
    __tablename__ = 'Clientes'
    
    id = db.Column(db.Integer, primary_key=True)
    nombre = db.Column(db.String(100))
    # Add other columns as needed

    def __repr__(self):
        return f'<Cliente {self.nombre}>'

# Routes
@app.route('/')
def index():
    return render_template('index.html')

@app.route('/clientes')
def index_clientes():
    clientes = Cliente.query.all()
    return render_template('modulos/clientes/index.html', clientes=clientes)

@app.route('/clientes/create')
def create():
    return render_template('/modulos/clientes/create.html')

if __name__ == '__main__':
    app.run(debug=True)
(Oct-23-2024, 06:00 PM)snippsat Wrote: [ -> ]Error you're encountering indicates that your MySQL client is attempting to establish an SSL/TLS connection to the MySQL server,
but the server does not support SSL/TLS connections.
This is a common issue when using the MySQLdb connector with newer versions of MySQL clients, where SSL is required by default.
Add this line:
app.config['MYSQL_SSL_DISABLED'] = True

Quote:The DB is created in XAMPP
XAMPP is not need,and add just old complicity not needed all in Python.

Flask-SQLAlchemy is better choice and can connect MySQL through it.
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

# Database configuration
# pip install mysql-connector-python
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:root@localhost:3306/Clientes'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

# Disable SSL
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
    'connect_args': {
        'ssl': {'ssl_disabled': True}
    }
}

db = SQLAlchemy(app)

# Define your model
class Cliente(db.Model):
    __tablename__ = 'Clientes'
    
    id = db.Column(db.Integer, primary_key=True)
    nombre = db.Column(db.String(100))
    # Add other columns as needed

    def __repr__(self):
        return f'<Cliente {self.nombre}>'

# Routes
@app.route('/')
def index():
    return render_template('index.html')

@app.route('/clientes')
def index_clientes():
    clientes = Cliente.query.all()
    return render_template('modulos/clientes/index.html', clientes=clientes)

@app.route('/clientes/create')
def create():
    return render_template('/modulos/clientes/create.html')

if __name__ == '__main__':
    app.run(debug=True)

Hello
Thanks for your reply.
I added exactly this line:

app.config['MYSQL_SSL_DISABLED'] = True

and the runtime error is the same.
I'm following a tutorial, so I have to use what they use. But I'll take your advice and when I succeed with this, I'll look for a tutorial with SQLALCHEMY.

Thank you.
Pablo
(Oct-24-2024, 06:44 PM)TheTiger Wrote: [ -> ]I'm following a tutorial, so I have to use what they use. But I'll take your advice and when I succeed with this, I'll look for a tutorial with SQLALCHEMY.
Here some tips,if just copy your first code and test it it work fine for me.
Setup database and test that it work.
G:\div_code\client_app
λ mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
.....

mysql> CREATE DATABASE Clientes;
Query OK, 1 row affected (0.04 sec)

mysql> USE Clientes;
Database changed
mysql> CREATE TABLE Clientes (
    ->     id INT AUTO_INCREMENT PRIMARY KEY,
    ->     nombre VARCHAR(100),
    ->     correo VARCHAR(100),
    ->     telefono VARCHAR(15),
    ->     direccion VARCHAR(255)
    -> );
Query OK, 0 rows affected (0.09 sec)

mysql> INSERT INTO Clientes (nombre, correo, telefono, direccion)
    -> VALUES
    -> ('John Doe', '[email protected]', '555-1234', '123 Main St'),
    -> ('Jane Smith', '[email protected]', '555-5678', '456 Maple Ave');
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> SELECT * FROM Clientes;
+----+------------+-----------------------+----------+---------------+
| id | nombre     | correo                | telefono | direccion     |
+----+------------+-----------------------+----------+---------------+
|  1 | John Doe   | [email protected]   | 555-1234 | 123 Main St   |
|  2 | Jane Smith | [email protected] | 555-5678 | 456 Maple Ave |
+----+------------+-----------------------+----------+---------------+
2 rows in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set (0.03 sec)

mysql>
Now DB tested and work,if i just add print(clientes) to your first code.
Then i get return form DB in Flask
Output:
G:\div_code\client_app λ python app.py * Serving Flask app 'app' * Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on http://127.0.0.1:5000 Press CTRL+C to quit 127.0.0.1 - - [26/Oct/2024 11:36:12] "GET / HTTP/1.1" 200 - ((1, 'John Doe', '[email protected]', '555-1234', '123 Main St'), (2, 'Jane Smith', '[email protected]', '555-5678', '456 Maple Ave')) 127.0.0.1 - - [26/Oct/2024 11:36:13] "GET /clientes HTTP/1.1" 200 -
Now can eg make clientes.html to display it browser.
Also change to app.config['MYSQL_CURSORCLASS'] = 'DictCursor'.
Ensures Flask-MySQLdb uses dictionary cursors correctly, allowing templates to access data by column name.
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Client List</title>
  </head>
  <body>
    <h1>Client List</h1>
    {% if clientes %}
    <table border="1">
      <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Email</th>
        <th>Phone</th>
        <th>Address</th>
      </tr>
      {% for client in clientes %}
      <tr>
        <td>{{ client['id'] }}</td>
        <td>{{ client['nombre'] }}</td>
        <td>{{ client['correo'] }}</td>
        <td>{{ client['telefono'] }}</td>
        <td>{{ client['direccion'] }}</td>
      </tr>
      {% endfor %}
    </table>
    {% else %}
    <p>No clients found.</p>
    {% endif %}

    <br />
    <a href="/clientes/create">Add New Client</a>
    <br />
    <a href="/">Back to Home</a>
  </body>
</html>
[Image: WNJg8R.png]
Hello
Thanks for all your help
But, you know, this is an issue after another one.
I tried to insert data into my db table, and, even though I set my Id column as primary key and autoincrement, it throws an MySQL error saying the column number is wrong. I wrote an INSERT like
INSERT INTO clientes VALUES (1, 'Joe Doe', '5555-1234', '2024/10/25')
and it was OK. It is supposed that the primary key colum is not passed to the INSERT VALUES list.
Any idea on how to solve this?
I can't attach a screen shot of the Id column definition because it doesn't give me option to upload a file, but my Id column is defined as Primary Key and A_I (autoincrement).
Thank you so much, again!
Pablo
PS: After this I will continue with your before reply to show the data in html.
Hello
I understood I had to pass the names of the columns to INSERT, so I was able to do that.
But the MySQL runtime error persists. I attach the main.py and index.html files.

from flask import Flask, render_template
from flask_mysqldb import MySQL

app = Flask(__name__)

mysql = MySQL()

app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_PORT'] = 3306
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'clientes'
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
app.config['MYSQL_SSL_DISABLED'] = True
mysql.init_app(app)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/clientes')
def index_clientes():

    sql = "SELECT * FROM cliente"
    conexion = mysql.connection
    cursor = conexion.cursor()
    cursor.execute(sql)
    clientes = cursor.fetchall()
    conexion.commit()
    print(clientes)
    return render_template('modulos/clientes/index.html', clientes=clientes)

@app.route('/clientes/create')
def create():
    return render_template('/modulos/clientes/create.html')

if __name__ == '__main__':
    app.run(debug=True)
[html]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Client List</title>
</head>
<body>
<h1>Client List</h1>
{% if clientes %}
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Phone</th>
<th>Date</th>
</tr>
{% for client in clientes %}
<tr>
<td>{{ client['id'] }}</td>
<td>{{ client['nombre'] }}</td>
<td>{{ client['telefono'] }}</td>
<td>{{ client['fecha'] }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>No clients found.</p>
{% endif %}

<br />
<a href="/clientes/create">Add New Client</a>
<br />
<a href="/">Back to Home</a>
</body>
</html>
[/html]

The error message (I don't know if it is exactly the same than before)

Error:
MySQLdb.OperationalError MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') Traceback (most recent call last) File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1498, in __call__ return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1476, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\PABLO\Desktop\sisclientes\main.py", line 25, in index_clientes conexion = mysql.connection ^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 109, in connection ctx.mysql_db = self.connect ^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 97, in connect return MySQLdb.connect(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\__init__.py", line 121, in Connect return Connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\connections.py", line 195, in __init__ super().__init__(*args, **kwargs2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object
I appreciate your help. I hope this has a solution.
Thank you!
Pablo
The error "MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it')" indicates that your MySQL client is trying to establish a secure SSL/TLS connection, but the MySQL server (in this case, running via XAMPP) does not support SSL connections by default. Here’s how you can address this issue:
Solution 1: Disable SSL in Your Flask App Configuration
You already tried app.config['MYSQL_SSL_DISABLED'] = True, but it did not work. This is because Flask-MySQLdb does not have a direct configuration for MYSQL_SSL_DISABLED. Instead, you need to set the SSL mode explicitly using ssl options.

Modify your connection setup in main.py like this:

python
Copy code
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_PORT'] = 3306
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'Clientes'
app.config['CURSORCLASS'] = 'DictCursor'
app.config['MYSQL_CLIENT_FLAG'] = 2  # This disables SSL
Explanation:

MYSQL_CLIENT_FLAG = 2 is used to disable SSL/TLS requirements when connecting to the server.
Solution 2: Force SSL Off via Connection Parameters
If the above solution does not work, try explicitly disabling SSL when initiating the connection:

python
Copy code
from flask_mysqldb import MySQL
import MySQLdb.cursors

app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
app.config['MYSQL_CONNECT_ARGS'] = {'ssl_disabled': True}  # This line forces SSL off

mysql = MySQL(app)
Solution 3: Adjust MySQL Server SSL Settings
If you have control over the MySQL server configuration (XAMPP in your case), you can disable the SSL requirement directly from the server side:

Open your MySQL configuration file (my.cnf or my.ini in XAMPP).
Add or modify the following lines under the [mysqld] section:
csharp
Copy code
[mysqld]
require_secure_transport = OFF
Restart the MySQL server from XAMPP.
Solution 4: Use SQLAlchemy
If you want a more robust solution for future projects, consider using SQLAlchemy. Here’s a brief setup:

python
Copy code
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:root@localhost/Clientes'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
    'connect_args': {'ssl': {'ssl_disabled': True}}
}

db = SQLAlchemy(app)
Why This Happens
Starting from MySQL 8.0, many MySQL clients and connectors (like MySQLdb) enforce SSL by default for security reasons. However, local development environments like XAMPP typically do not have SSL configured, leading to the error.

Try these solutions in order, and one of them should resolve your issue. Let me know if you encounter further problems.
(Oct-29-2024, 02:51 AM)TheTiger Wrote: [ -> ]Hello
I understood I had to pass the names of the columns to INSERT, so I was able to do that.
But the MySQL runtime error persists. I attach the main.py and index.html files.

from flask import Flask, render_template
from flask_mysqldb import MySQL

app = Flask(__name__)

mysql = MySQL()

app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_PORT'] = 3306
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'root'
app.config['MYSQL_DB'] = 'clientes'
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
app.config['MYSQL_SSL_DISABLED'] = True
mysql.init_app(app)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/clientes')
def index_clientes():

    sql = "SELECT * FROM cliente"
    conexion = mysql.connection
    cursor = conexion.cursor()
    cursor.execute(sql)
    clientes = cursor.fetchall()
    conexion.commit()
    print(clientes)
    return render_template('modulos/clientes/index.html', clientes=clientes)

@app.route('/clientes/create')
def create():
    return render_template('/modulos/clientes/create.html')

if __name__ == '__main__':
    app.run(debug=True)
[html]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Client List</title>
</head>
<body>
<h1>Client List</h1>
{% if clientes %}
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Phone</th>
<th>Date</th>
</tr>
{% for client in clientes %}
<tr>
<td>{{ client['id'] }}</td>
<td>{{ client['nombre'] }}</td>
<td>{{ client['telefono'] }}</td>
<td>{{ client['fecha'] }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>No clients found.</p>
{% endif %}

<br />
<a href="/clientes/create">Add New Client</a>
<br />
<a href="/">Back to Home</a>
</body>
</html>
[/html]

The error message (I don't know if it is exactly the same than before)

Error:
MySQLdb.OperationalError MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') Traceback (most recent call last) File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1498, in __call__ return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1476, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\PABLO\Desktop\sisclientes\main.py", line 25, in index_clientes conexion = mysql.connection ^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 109, in connection ctx.mysql_db = self.connect ^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask_mysqldb\__init__.py", line 97, in connect return MySQLdb.connect(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\__init__.py", line 121, in Connect return Connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\MySQLdb\connections.py", line 195, in __init__ super().__init__(*args, **kwargs2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MySQLdb.OperationalError: (2026, 'TLS/SSL error: SSL is required, but the server does not support it') The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object
I appreciate your help. I hope this has a solution.
Thank you!
Pablo


Did you ever find a fix for this? I'm having the same issue
Hello MoMoProxy
Sorry for the delay in answering your message, I thought nobody was going to reply to my issue.
The first 3 Solutions do not work. So now I'm following a tutorial about SQLAlchemy.
Thank you very much for your help.
Pablo