Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mysql.connector
#1
In Ubuntu and Python 3.5.2 I want to connect to a Mysql-Database.

With the command "import mysql.connector" I get an ImportError "No module named 'mysql'".
Checking the installation of mysql-connector I get with

pip search mysql-connector | grep --color mysql-connector-python

Quote:mysql-connector-python (8.0.19) - MySQL driver written in Python
mysql-connector-python-dd (2.0.2) - MySQL driver written in Python
mysql-connector-python-rf (2.2.2) - MySQL driver written in Python

What can be the reason of the error ?

Meanwhile I found the following solution:

sudo apt-get install python3-mysql.connector
Reply
#2
pip search will index packages,
you need to use pip install packagename to actually install a package.
and of course, the package has to be installed before using.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql and mysql.connector error lostintime 2 611 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,676 Feb-09-2022, 09:55 AM
Last Post: ibreeden
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,572 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 5,465 Jan-18-2022, 06:25 PM
Last Post: ilknurg
  Program stuck at mysql.connector.connect zazas321 1 2,039 Jul-29-2021, 10:49 AM
Last Post: zazas321
  MYSQL.CONNECTOR ERROR DB1 8 3,776 Jul-23-2021, 03:31 AM
Last Post: DB1
  Trouble retrieving dictionary from mysql.connector cursor swechsler 2 2,993 Sep-17-2019, 05:21 PM
Last Post: swechsler
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 2,775 Jun-11-2019, 04:14 PM
Last Post: pcarra
  Add a stored procedure with variable using MySQL Connector UtiliseIT 0 2,267 May-04-2019, 12:46 PM
Last Post: UtiliseIT
  MySQL Connector trai 1 2,158 May-03-2019, 11:34 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020