SlideShare a Scribd company logo
No module named ‘mysql’
in Python
www.tutorialandexample.com
MODULENOT
FOUNDERROR
INTRODUCTION
One common reason for this error is that
the MySQL module is not installed on
your system. Try importing the module in
a Python script to check if this is the case.
If the module is not installed, the
interpreter will raise the
“ModuleNotFoundError.”
MYSQLPYTHON:ABOUTMYSQL
•MySQL is a fast, easy-to-use relational database. It is currently the most
popular open-source database
•MySQL is used for many small and big businesses. It is developed,
marketed, and supported by MySQL AB, a Swedish company. It is written in C
and C++.
•MySQL is an open-source database, so you don’t have to pay a single
penny to use it. MySQL Features
•MySQL is a fast, easy-to-use relational database.
•MySQL is used for many small and big businesses.
•MySQL is an open-source database, so you don’t have to pay.
MySQL module not found is an error that
occurs in Python. This error occurs when you
forget to install a module called mysql-
connector-python in a preferable
environment.
ModuleNotError:
No module named
'mysql.'
To fix this error, we install a new module by using a command
called
pip install mysql-connector-python
If this error occurs, you have to open the project's root directory and
install the module by using the above command. This command
only works in a virtual environment. Or by using Python 2.
pip3 install mysql-connector-python
For Python 3, use the command
below:
By installing this module, sometimes you might get a permission error. To fix that, we
use the command below
sudo pip3 install mysql-connector-python
sometimes you won't get pip in the PATH environment variable then we use the bellow
command to fix that error
python -m pip install mysql-connector-python
if you get the same error while working in python 3, then we use the below
command for it
python3 -m pip install mysql-connector-python
for anaconda, we use the below command
conda install -c anaconda mysql-connector-python
After installing the mysql-connector-python, we have to import that again in the code
to use it. For example, let us see an example code:
import mysql.connector
# Connect to server
cnx = mysql.connector.connect(
host="127.0.0.1",
port=3305,
user="andy",
password="$unrise_123")
# Get a cursor
cur = cnx.cursor()
# Execute a query
cur.execute("SELECT CURDATE()")
# Fetch one result
row = cur.fetchone()
print("Current date is: {0}".format(row[0]))
# Close connection'
cnx.close()
Output:
Current date is: {0}
Not having the pre-installed package mysql-connector-python we can -install
it by using the pip install mysql-connector-python.
If you install the package of another version without checking the version of
your system, an error occurs
Whenever we install the package worldwide, we must use the virtual
environment, or an error occurs.
If the Python version of the IDE you are working on, you will get an error.
If you cover the name of the official module by naming the nodule mysql.py
Anytime you use a module name as a variable name, the variable name will
import the variable.
Few reasons for the error
ModuleNotFoundError
THANK
YOUVERY
MUCH!
PRESENTEDBYJAVATPOINT
www.tutorialandexample.com
Ad

More Related Content

What's hot (20)

SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
Swapnali Pawar
 
Class 12 CS Ch-16 MySQL PPT.pptx
Class 12 CS Ch-16 MySQL PPT.pptxClass 12 CS Ch-16 MySQL PPT.pptx
Class 12 CS Ch-16 MySQL PPT.pptx
DeepaG66
 
Compiler: Syntax Analysis
Compiler: Syntax AnalysisCompiler: Syntax Analysis
Compiler: Syntax Analysis
Dr. Jaydeep Patil
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Mohammed Sikander
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
Emertxe Information Technologies Pvt Ltd
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
Karan Deopura
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
shamim hossain
 
Crash Course on R Shiny Package
Crash Course on R Shiny Package Crash Course on R Shiny Package
Crash Course on R Shiny Package
Rohit Dubey
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
Megha V
 
C pointer
C pointerC pointer
C pointer
University of Potsdam
 
SE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptxSE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptx
Bharat Chawda
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
Moutasm Tamimi
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
sonalikharade3
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
Abhilash Nair
 
Software process
Software processSoftware process
Software process
Jennifer Polack
 
Java thread life cycle
Java thread life cycleJava thread life cycle
Java thread life cycle
Archana Gopinath
 
bca data structure
bca data structurebca data structure
bca data structure
shini
 
SQL select clause
SQL select clauseSQL select clause
SQL select clause
arpit bhadoriya
 
Class 12 CS Ch-16 MySQL PPT.pptx
Class 12 CS Ch-16 MySQL PPT.pptxClass 12 CS Ch-16 MySQL PPT.pptx
Class 12 CS Ch-16 MySQL PPT.pptx
DeepaG66
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
shamim hossain
 
Crash Course on R Shiny Package
Crash Course on R Shiny Package Crash Course on R Shiny Package
Crash Course on R Shiny Package
Rohit Dubey
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
Megha V
 
SE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptxSE2023 0401 Software Coding and Testing.pptx
SE2023 0401 Software Coding and Testing.pptx
Bharat Chawda
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
Moutasm Tamimi
 
bca data structure
bca data structurebca data structure
bca data structure
shini
 

Similar to Modulenotfounderror No module named 'mysql' in Python (20)

Sql installation
Sql installationSql installation
Sql installation
Balakumaran Arunachalam
 
Interface python with sql database.pdf
Interface python with sql database.pdfInterface python with sql database.pdf
Interface python with sql database.pdf
MohammadImran709594
 
Interface python with sql database.pdf--
Interface python with sql database.pdf--Interface python with sql database.pdf--
Interface python with sql database.pdf--
jagaspeed09
 
Python - mySOL
Python - mySOLPython - mySOL
Python - mySOL
Learnbay Datascience
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
Sanmuga Nathan
 
Interface python with sql database10.pdf
Interface python with sql database10.pdfInterface python with sql database10.pdf
Interface python with sql database10.pdf
HiteshNandi
 
My Sq Ldb Tut
My Sq Ldb TutMy Sq Ldb Tut
My Sq Ldb Tut
AkramWaseem
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
Thava Alagu
 
How to setup and connect my sql to ec2 instance from ubuntu
How to setup and connect my sql to ec2 instance from ubuntuHow to setup and connect my sql to ec2 instance from ubuntu
How to setup and connect my sql to ec2 instance from ubuntu
Katy Slemon
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
Sveta Smirnova
 
Node.js with MySQL.pdf
Node.js with MySQL.pdfNode.js with MySQL.pdf
Node.js with MySQL.pdf
SudhanshiBakre1
 
MySQL on Docker and Kubernetes
MySQL on Docker and KubernetesMySQL on Docker and Kubernetes
MySQL on Docker and Kubernetes
Balasubramanian Kandasamy
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
Ulf Wendel
 
Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
cavicav231
 
The power of mysqlnd plugins
The power of mysqlnd pluginsThe power of mysqlnd plugins
The power of mysqlnd plugins
Ulf Wendel
 
Django_3_Tutorial_and_CRUD_Example_with.pdf
Django_3_Tutorial_and_CRUD_Example_with.pdfDjango_3_Tutorial_and_CRUD_Example_with.pdf
Django_3_Tutorial_and_CRUD_Example_with.pdf
Damien Raczy
 
Chapter 6 Interface Python with MYSQL.pptx
Chapter 6 Interface Python with MYSQL.pptxChapter 6 Interface Python with MYSQL.pptx
Chapter 6 Interface Python with MYSQL.pptx
sarofba
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
SULTHAN BASHA
 
Interface python with sql database.pdf
Interface python with sql database.pdfInterface python with sql database.pdf
Interface python with sql database.pdf
MohammadImran709594
 
Interface python with sql database.pdf--
Interface python with sql database.pdf--Interface python with sql database.pdf--
Interface python with sql database.pdf--
jagaspeed09
 
Interface python with sql database10.pdf
Interface python with sql database10.pdfInterface python with sql database10.pdf
Interface python with sql database10.pdf
HiteshNandi
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
Thava Alagu
 
How to setup and connect my sql to ec2 instance from ubuntu
How to setup and connect my sql to ec2 instance from ubuntuHow to setup and connect my sql to ec2 instance from ubuntu
How to setup and connect my sql to ec2 instance from ubuntu
Katy Slemon
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
Ulf Wendel
 
Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
cavicav231
 
The power of mysqlnd plugins
The power of mysqlnd pluginsThe power of mysqlnd plugins
The power of mysqlnd plugins
Ulf Wendel
 
Django_3_Tutorial_and_CRUD_Example_with.pdf
Django_3_Tutorial_and_CRUD_Example_with.pdfDjango_3_Tutorial_and_CRUD_Example_with.pdf
Django_3_Tutorial_and_CRUD_Example_with.pdf
Damien Raczy
 
Chapter 6 Interface Python with MYSQL.pptx
Chapter 6 Interface Python with MYSQL.pptxChapter 6 Interface Python with MYSQL.pptx
Chapter 6 Interface Python with MYSQL.pptx
sarofba
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
SULTHAN BASHA
 
Ad

More from Himani415946 (20)

Python Tutorial | Python Programming Language - Tpointtech
Python Tutorial | Python Programming Language - TpointtechPython Tutorial | Python Programming Language - Tpointtech
Python Tutorial | Python Programming Language - Tpointtech
Himani415946
 
Highest Himalaya Mountain Peak India - TpointTech
Highest Himalaya Mountain Peak India - TpointTechHighest Himalaya Mountain Peak India - TpointTech
Highest Himalaya Mountain Peak India - TpointTech
Himani415946
 
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTechPHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
Himani415946
 
SEO Google Algorithm Updates - TpointTech
SEO Google Algorithm Updates - TpointTechSEO Google Algorithm Updates - TpointTech
SEO Google Algorithm Updates - TpointTech
Himani415946
 
SQL(Structured Query Language) Tutorials TpointTech
SQL(Structured Query Language) Tutorials TpointTechSQL(Structured Query Language) Tutorials TpointTech
SQL(Structured Query Language) Tutorials TpointTech
Himani415946
 
Cyber Security MCQ/Interview Questions - TpointTech
Cyber Security MCQ/Interview Questions - TpointTechCyber Security MCQ/Interview Questions - TpointTech
Cyber Security MCQ/Interview Questions - TpointTech
Himani415946
 
What is Statistics Definition PPT - TpointTech
What is Statistics Definition PPT - TpointTechWhat is Statistics Definition PPT - TpointTech
What is Statistics Definition PPT - TpointTech
Himani415946
 
ER(Entity Relationship) Diagram for online shopping
ER(Entity Relationship) Diagram for online shoppingER(Entity Relationship) Diagram for online shopping
ER(Entity Relationship) Diagram for online shopping
Himani415946
 
Top 16 Groovy(Tutorial) Interview Questions - TAE
Top 16 Groovy(Tutorial) Interview Questions - TAETop 16 Groovy(Tutorial) Interview Questions - TAE
Top 16 Groovy(Tutorial) Interview Questions - TAE
Himani415946
 
Gini Index formula- Javatpoint
Gini Index formula- JavatpointGini Index formula- Javatpoint
Gini Index formula- Javatpoint
Himani415946
 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning Tutorial
Himani415946
 
What is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and ApplicationsWhat is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and Applications
Himani415946
 
What is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and ApplicationsWhat is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and Applications
Himani415946
 
Romancham: Movie Review
Romancham: Movie Review Romancham: Movie Review
Romancham: Movie Review
Himani415946
 
Types of Computer, Definition
Types of Computer, Definition Types of Computer, Definition
Types of Computer, Definition
Himani415946
 
Big data Hadoop Training- Javatpoint
Big data Hadoop Training- Javatpoint Big data Hadoop Training- Javatpoint
Big data Hadoop Training- Javatpoint
Himani415946
 
7 reasons to take java certifications
7 reasons to take java certifications7 reasons to take java certifications
7 reasons to take java certifications
Himani415946
 
Java Tutorial | What is Java?
Java Tutorial | What is Java?Java Tutorial | What is Java?
Java Tutorial | What is Java?
Himani415946
 
Java Tutorial | What is Java?
Java Tutorial | What is Java?Java Tutorial | What is Java?
Java Tutorial | What is Java?
Himani415946
 
AWS Training- javatpoint
AWS Training- javatpointAWS Training- javatpoint
AWS Training- javatpoint
Himani415946
 
Python Tutorial | Python Programming Language - Tpointtech
Python Tutorial | Python Programming Language - TpointtechPython Tutorial | Python Programming Language - Tpointtech
Python Tutorial | Python Programming Language - Tpointtech
Himani415946
 
Highest Himalaya Mountain Peak India - TpointTech
Highest Himalaya Mountain Peak India - TpointTechHighest Himalaya Mountain Peak India - TpointTech
Highest Himalaya Mountain Peak India - TpointTech
Himani415946
 
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTechPHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
PHP Tutorial | What is PHP? Features, Advantage and Disadvantage - TpointTech
Himani415946
 
SEO Google Algorithm Updates - TpointTech
SEO Google Algorithm Updates - TpointTechSEO Google Algorithm Updates - TpointTech
SEO Google Algorithm Updates - TpointTech
Himani415946
 
SQL(Structured Query Language) Tutorials TpointTech
SQL(Structured Query Language) Tutorials TpointTechSQL(Structured Query Language) Tutorials TpointTech
SQL(Structured Query Language) Tutorials TpointTech
Himani415946
 
Cyber Security MCQ/Interview Questions - TpointTech
Cyber Security MCQ/Interview Questions - TpointTechCyber Security MCQ/Interview Questions - TpointTech
Cyber Security MCQ/Interview Questions - TpointTech
Himani415946
 
What is Statistics Definition PPT - TpointTech
What is Statistics Definition PPT - TpointTechWhat is Statistics Definition PPT - TpointTech
What is Statistics Definition PPT - TpointTech
Himani415946
 
ER(Entity Relationship) Diagram for online shopping
ER(Entity Relationship) Diagram for online shoppingER(Entity Relationship) Diagram for online shopping
ER(Entity Relationship) Diagram for online shopping
Himani415946
 
Top 16 Groovy(Tutorial) Interview Questions - TAE
Top 16 Groovy(Tutorial) Interview Questions - TAETop 16 Groovy(Tutorial) Interview Questions - TAE
Top 16 Groovy(Tutorial) Interview Questions - TAE
Himani415946
 
Gini Index formula- Javatpoint
Gini Index formula- JavatpointGini Index formula- Javatpoint
Gini Index formula- Javatpoint
Himani415946
 
Deep Learning Tutorial
Deep Learning TutorialDeep Learning Tutorial
Deep Learning Tutorial
Himani415946
 
What is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and ApplicationsWhat is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and Applications
Himani415946
 
What is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and ApplicationsWhat is Data science and how does it works- Tutorial, Jobs and Applications
What is Data science and how does it works- Tutorial, Jobs and Applications
Himani415946
 
Romancham: Movie Review
Romancham: Movie Review Romancham: Movie Review
Romancham: Movie Review
Himani415946
 
Types of Computer, Definition
Types of Computer, Definition Types of Computer, Definition
Types of Computer, Definition
Himani415946
 
Big data Hadoop Training- Javatpoint
Big data Hadoop Training- Javatpoint Big data Hadoop Training- Javatpoint
Big data Hadoop Training- Javatpoint
Himani415946
 
7 reasons to take java certifications
7 reasons to take java certifications7 reasons to take java certifications
7 reasons to take java certifications
Himani415946
 
Java Tutorial | What is Java?
Java Tutorial | What is Java?Java Tutorial | What is Java?
Java Tutorial | What is Java?
Himani415946
 
Java Tutorial | What is Java?
Java Tutorial | What is Java?Java Tutorial | What is Java?
Java Tutorial | What is Java?
Himani415946
 
AWS Training- javatpoint
AWS Training- javatpointAWS Training- javatpoint
AWS Training- javatpoint
Himani415946
 
Ad

Recently uploaded (20)

Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 

Modulenotfounderror No module named 'mysql' in Python

  • 1. No module named ‘mysql’ in Python www.tutorialandexample.com MODULENOT FOUNDERROR
  • 2. INTRODUCTION One common reason for this error is that the MySQL module is not installed on your system. Try importing the module in a Python script to check if this is the case. If the module is not installed, the interpreter will raise the “ModuleNotFoundError.”
  • 3. MYSQLPYTHON:ABOUTMYSQL •MySQL is a fast, easy-to-use relational database. It is currently the most popular open-source database •MySQL is used for many small and big businesses. It is developed, marketed, and supported by MySQL AB, a Swedish company. It is written in C and C++. •MySQL is an open-source database, so you don’t have to pay a single penny to use it. MySQL Features •MySQL is a fast, easy-to-use relational database. •MySQL is used for many small and big businesses. •MySQL is an open-source database, so you don’t have to pay.
  • 4. MySQL module not found is an error that occurs in Python. This error occurs when you forget to install a module called mysql- connector-python in a preferable environment. ModuleNotError: No module named 'mysql.'
  • 5. To fix this error, we install a new module by using a command called pip install mysql-connector-python If this error occurs, you have to open the project's root directory and install the module by using the above command. This command only works in a virtual environment. Or by using Python 2.
  • 6. pip3 install mysql-connector-python For Python 3, use the command below:
  • 7. By installing this module, sometimes you might get a permission error. To fix that, we use the command below sudo pip3 install mysql-connector-python sometimes you won't get pip in the PATH environment variable then we use the bellow command to fix that error python -m pip install mysql-connector-python if you get the same error while working in python 3, then we use the below command for it python3 -m pip install mysql-connector-python for anaconda, we use the below command conda install -c anaconda mysql-connector-python
  • 8. After installing the mysql-connector-python, we have to import that again in the code to use it. For example, let us see an example code: import mysql.connector # Connect to server cnx = mysql.connector.connect( host="127.0.0.1", port=3305, user="andy", password="$unrise_123") # Get a cursor cur = cnx.cursor() # Execute a query cur.execute("SELECT CURDATE()") # Fetch one result row = cur.fetchone() print("Current date is: {0}".format(row[0])) # Close connection' cnx.close() Output: Current date is: {0}
  • 9. Not having the pre-installed package mysql-connector-python we can -install it by using the pip install mysql-connector-python. If you install the package of another version without checking the version of your system, an error occurs Whenever we install the package worldwide, we must use the virtual environment, or an error occurs. If the Python version of the IDE you are working on, you will get an error. If you cover the name of the official module by naming the nodule mysql.py Anytime you use a module name as a variable name, the variable name will import the variable. Few reasons for the error ModuleNotFoundError