Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'mysql'

Tags:

python

mysql

Trying to store values in sql using Python Cgi script, I have downloaded the Connector/Python for MySQL successfully. I used the following code in Python's shell to test my connection:

import mysql.connector

I received the following error message:

ModuleNotFoundError: No module named 'mysql'

when trying to import MySQL.connector.

like image 452
Cell Avatar asked Dec 11 '22 12:12

Cell


2 Answers

Just try this command:

pip install mysql-connector-python-rf

then try your command again, it'll run correctly.

like image 54
Eslam Saber Avatar answered Dec 13 '22 21:12

Eslam Saber


try below command

pip install mysql-connector

like image 45
Kairat Koibagarov Avatar answered Dec 13 '22 22:12

Kairat Koibagarov