Python Forum
mysql.connector - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: mysql.connector (/thread-25740.html)



mysql.connector - Nobima - Apr-10-2020

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


RE: mysql.connector - Larz60+ - Apr-10-2020

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.