0

i have ubunto 24.04 lts on my system and python 3.12. i have installed connector/python 8.0.15 and i cant to connect my database.

import mysql.connector
cnx = mysql.connector.connect(user='root', password='mypass', host='localhost', database='db')

my error is:

   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'

i have to install connector/python version 8.4 on my ubunto but dont know how to uninstall it and install the new verion

4
  • How did you install connector 8.0.15? Every install thing has an uninstall or upgrade option. Commented Jul 5, 2024 at 17:58
  • sudo apt-get install python3-mysql.connector Commented Jul 5, 2024 at 20:08
  • I suggest you apt remove that and then sudo pip install mysqlx-connector-python. Commented Jul 5, 2024 at 21:34
  • Do yo found how to solve the issue? Commented Nov 7, 2024 at 13:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.