ModuleNotFoundError No module named mysql

0 votes

Hi Guys,

I am trying to connect MySQL with python. But I am getting this below error.

import mysql.connector
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-7-e4a81bca169b> in <module>
----> 1 import mysql.connector
ModuleNotFoundError: No module named 'mysql'
Jul 15, 2020 in Python by akhtar
• 38,260 points
50,627 views
Not solved please help urgently

1 answer to this question.

0 votes

Hi@akhtar,

You need to install mysql-connector to connect Python with MySQL. You can use the below command to install this in your system.

 C:\Users\Nadeem Akhter>pip install mysql-connector-python-rf
Collecting mysql-connector-python-rf
  Downloading mysql-connector-python-rf-2.2.2.tar.gz (11.9 MB)
     |████████████████████████████████| 11.9 MB 111 kB/s
Building wheels for collected packages: mysql-connector-python-rf
  Building wheel for mysql-connector-python-rf (setup.py) ... done
  Created wheel for mysql-connector-python-rf: filename=mysql_connector_python_rf-2.2.2-cp36-cp36m-win_amd64.whl size=249460 sha256=b3b15baa6cbb68935e2c221725ca7133f2714623b26531f2e34f56b0e3d051ee
  Stored in directory: c:\users\nadeem akhter\appdata\local\pip\cache\wheels\51\40\3f\136443b7177ee453aa9d6c8862fc2d1a1ea8ff8ee0999d1971
Successfully built mysql-connector-python-rf
Installing collected packages: mysql-connector-python-rf
Successfully installed mysql-connector-python-rf-2.2.2
Get a further understanding from the Microsoft SQL course
answered Jul 15, 2020 by MD
• 95,460 points
How did you changed that settings?
It's really useful
i get this error whenever i type the code to install the python connector

 unexpected character after line continuation character
thankyou so much for this information
I have installed this still my code is showing this error "no module named mysql" on vscode. But when I am importing mysql.connector in the file it does not show any error in the code only the error is coming in the terminal after clicking on run button.
0 votes
don't give filaname as mysql.py give another name  .py i solved with this
answered Jan 6, 2022 by anonymous

edited Mar 5

Related Questions In Python

+1 vote
3 answers
+2 votes
3 answers

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

answered Aug 20, 2019 in Python by Raman
82,725 views
0 votes
2 answers

ModuleNotFoundError: No module named 'pythoncom' in pyttsx3

even i faced the same problem ...just ...READ MORE

answered Jun 2, 2020 in Python by anonymous
14,387 views
0 votes
1 answer

ModuleNotFoundError: No module named 'Foundation'

Hi@akhtar, By default Foundation module comes with Anaconda ...READ MORE

answered Apr 24, 2020 in Python by MD
• 95,460 points
4,254 views
0 votes
1 answer

ProgrammingError: not all arguments converted during string formatting

Sorted!!!! just found the solution, 1 - apparently ...READ MORE

answered Sep 10, 2018 in Python by Priyaj
• 58,020 points
20,565 views
0 votes
1 answer

Create a database table using python

Hey @Kim, try something like this: import MySQLdb # ...READ MORE

answered Jul 23, 2019 in Python by Barbara
1,354 views
0 votes
1 answer

How to output text from database with line breaks in a django template?

Hello @kartik, Use linebreaks or linebreaksbr filter: {{ text|linebreaks }} Or surround the text ...READ MORE

answered Jun 24, 2020 in Python by Niroj
• 82,840 points
13,806 views
0 votes
1 answer

Error:Python3.4 can't install mysql-python

Hello @kartik, You can resolved this by the ...READ MORE

answered Jun 24, 2020 in Python by Niroj
• 82,840 points
2,331 views
+3 votes
3 answers

ModuleNotFoundError: No module named 'cv2'

Hi@akhtar, This error may occur if you didn't install ...READ MORE

answered Apr 9, 2020 in Python by MD
• 95,460 points
272,148 views
+2 votes
2 answers

ModuleNotFoundError: No module named 'pyttsx3

Hi@akhtar, To avoid this error you have to ...READ MORE

answered Apr 24, 2020 in Python by MD
• 95,460 points
30,054 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP