我的系统上有 ubunto 24.04 lts 和 python 3.12。我已经安装了连接器/python 8.0.15,但我无法连接我的数据库。导入 mysql.connectorcnx = mysql.connector.connect(user='root',
我的系统上有 ubunto 24.04 lts 和 python 3.12。我已经安装了连接器/python 8.0.15,但我无法连接我的数据库。
import mysql.connector
cnx = mysql.connector.connect(user='root', password='mypass', host='localhost', database='db')
我的错误是:
File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 102, in __init__
self.connect(**kwargs)
File "/usr/lib/python3/dist-packages/mysql/connector/abstracts.py", line 735, in connect
self._open_connection()
File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 250, in _open_connection
self._do_auth(self._user, self._password,
File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 155, in _do_auth
self._socket.switch_to_ssl(ssl_options.get('ca'),
File "/usr/lib/python3/dist-packages/mysql/connector/network.py", line 427, in switch_to_ssl
self.sock = ssl.wrap_socket(
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'
我必须在我的 ubunto 上安装连接器/python 版本 8.4,但不知道如何卸载它并安装新版本