Python Forum

Full Version: mysql.connector
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.