Python Tutorials
- Python
- How to install Python?
- PIP
- How to Run Python Program
- Python Identifiers,Statement, Indentation and Comments
- Variable
- Data type
- Decision Making
- Python Loops
- Break,Continue, Pass
- Functions
- Predefine Functions
- Lambda Functions
- Variable Scope
- List
- Tuple
- Python Sets
- Python Dictionary
- Python String
- String Formating
- Input/Output
- File Handling (Input / Output)
- Iterators
- Python Modules
- Python Date
- Python JSON
- Classes and Objects
- Constructor
- Polymorphism
- Encapsulation
- inheritance
- Class or Static Variables in Python
- class method vs static method
- Abstraction
- Exception Handling
- MySql Python
- MySql Create Database
- MySql CRUD
- Django
How to Install mysql.connector?
To connect the python application with the MySQL database, we must import the mysql.connector module in the program. The mysql.connector is not a built-in module that comes with the python installation. We need to install it to get it working.
Run the following command to install it using pip installer.
File name : index.py
python -m pip install mysql-connector
Download and install "MySQL Connector":
File name : index.py
C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>python -m pip install mysql-connector-python
Step
File name : index.py
Download MySql Connector
Download
Download MySQl
2. Extract the archived file
Open the terminal (CMD for windows) and change the present working directory to the source code directory.
cd mysql-connector-python-8.0.13/
Run the file named setup.py with python.
python setup.py build
Run the following command to install the mysql-connector.
python setup.py install
Test MySQL Connector
To test if the installation was successful, or if you already have "MySQL Connector" installed, create a Python page with the following content:
File name : demo_mysql_test.py
import mysql.connector
If the above code was executed with no errors, "MySQL Connector" is installed and ready to be used.
File name : index.py
File name : index.py
File name : index.py