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

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

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
 
MySQL up and running 30 minutes.pdf
MySQL up and running 30 minutes.pdfMySQL up and running 30 minutes.pdf
MySQL up and running 30 minutes.pdf
Vinicius M Grippa
 
Lovely
LovelyLovely
Lovely
Lester Anota
 
UNIT-3.pdf, buffer module, treams,file accessing using node js
UNIT-3.pdf, buffer module, treams,file accessing using node jsUNIT-3.pdf, buffer module, treams,file accessing using node js
UNIT-3.pdf, buffer module, treams,file accessing using node js
chandrapuraja
 
Python - db.pptx
Python - db.pptxPython - db.pptx
Python - db.pptx
RAGAVIC2
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
Laurent Leturgez
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Database
dharawagh9999
 
Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)
Valeriy Kravchuk
 
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
 
MySQL up and running 30 minutes.pdf
MySQL up and running 30 minutes.pdfMySQL up and running 30 minutes.pdf
MySQL up and running 30 minutes.pdf
Vinicius M Grippa
 
UNIT-3.pdf, buffer module, treams,file accessing using node js
UNIT-3.pdf, buffer module, treams,file accessing using node jsUNIT-3.pdf, buffer module, treams,file accessing using node js
UNIT-3.pdf, buffer module, treams,file accessing using node js
chandrapuraja
 
Python - db.pptx
Python - db.pptxPython - db.pptx
Python - db.pptx
RAGAVIC2
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
Laurent Leturgez
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Database
dharawagh9999
 
Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)Applying profilers to my sql (fosdem 2017)
Applying profilers to my sql (fosdem 2017)
Valeriy Kravchuk
 

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)

The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
CSUC - Consorci de Serveis Universitaris de Catalunya
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of ExchangesJignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah Innovator
 
The Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdfThe Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdf
Precisely
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of ExchangesJignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah Innovator
 
The Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdfThe Changing Compliance Landscape in 2025.pdf
The Changing Compliance Landscape in 2025.pdf
Precisely
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
Ad

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
  翻译: