🌐
PyPI
pypi.org › project › mysql-connector-python
mysql-connector-python · PyPI
A self-contained Python driver for communicating with MySQL servers, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249). ... MySQL Connector/Python enables Python programs to access MySQL databases, using ...
      » pip install mysql-connector-python
    
Published   Apr 23, 2026
Version   9.7.0
🌐
MySQL
dev.mysql.com › doc › connector-python › en
MySQL :: MySQL Connector/Python Developer Guide
This manual describes how to install and configure MySQL Connector/Python, a self-contained Python driver for communicating with MySQL servers, and how to use it to develop database applications.
Discussions

How to connect MySQL database using Python (mysql.connector) remotely? - Python Help - Discussions on Python.org
What I want to implement is a Python script that performs operations on a database. The database is hosted on a PC A [it is my personal PC (OS = Windows 10), on which I have installed XAMMP to manage a db (‘‘MySQL’’)]. Through phpMyAdmin I created 2 types of user: Root “type” user: ... More on discuss.python.org
🌐 discuss.python.org
1
December 16, 2021
I'm having trouble connecting with Python MySQL connector
The option in question is not inside MySQL/Workbench, but a python config option. When you create the cnx object, add auth_plugin='mysql_native_password' inside the connect(). More on reddit.com
🌐 r/mysql
3
1
July 1, 2019
What is the best mysqlconnector for flask? flask-mysql vs mysql-connector ?
🌐 r/flask
7
5
November 10, 2023
Comparison of MySQL Connectors for Python and Optimal Method for Faster Insertion/Updating
I highly doubt there is any measurable difference in speed. The time taken to insert data in a db will be dominated by two things: the network latency (if the db is not local), and the actual db time (which will be affected by things like how big the records are, how many indexes need updating, whether you're committing transactions after each insert, etc). More on reddit.com
🌐 r/learnpython
1
1
December 26, 2023
🌐
W3Schools
w3schools.com › python › python_mysql_getstarted.asp
Python MySQL
C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>python -m pip install mysql-connector-python
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-example-connecting.html
MySQL :: MySQL Connector/Python Developer Guide :: 5.1 Connecting to MySQL Using Connector/Python
import mysql.connector cnx = mysql.connector.connect(user='scott', password='password', host='127.0.0.1', database='employees') cnx.close() Section 7.1, “Connector/Python Connection Arguments” describes the permitted connection arguments.
🌐
MySQL
dev.mysql.com › downloads › connector › python
MySQL :: Download Connector/Python
MySQL Connector/Python is a standardized database driver for Python platforms and development.
🌐
OneUptime
oneuptime.com › home › blog › how to use mysql with python's mysql-connector-python
How to Use MySQL with Python's mysql-connector-python
March 31, 2026 - It allows Python applications to connect to MySQL databases, execute queries, and manage transactions without any external C dependencies (pure Python implementation available). ... import mysql.connector conn = mysql.connector.connect( ...
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-connectargs.html
MySQL :: MySQL Connector/Python Developer Guide :: 7.1 Connector/Python Connection Arguments
When the database argument is given, the current database is set to the given value. To change the current database later, execute a USE SQL statement or set the database property of the MySQLConnection instance. By default, Connector/Python tries to connect to a MySQL server running on the local host using TCP/IP.
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-reference.html
MySQL :: MySQL Connector/Python Developer Guide :: 10 Connector/Python API Reference
This chapter contains the public API reference for Connector/Python. Examples should be considered working for Python 2.7, and Python 3.1 and greater. They might also work for older versions (such as Python 2.4) unless they use features introduced in newer Python versions.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-mysql
Python MySQL - GeeksforGeeks
Integrating it with Python enables efficient data storage, retrieval and manipulation within applications. To work with MySQL, we use MySQL Connector, a driver that enables seamless integration between the two.
Published   May 22, 2026
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-examples.html
MySQL :: MySQL Connector/Python Developer Guide :: 5 Connector/Python Coding Examples
These coding examples illustrate how to develop Python applications and scripts which connect to MySQL Server using MySQL Connector/Python.
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-introduction.html
MySQL :: MySQL Connector/Python Developer Guide :: 1 Introduction to MySQL Connector/Python
MySQL Connector/Python enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249).
🌐
PYnative
pynative.com › home › python › databases › python mysql database connection using mysql connector
Python MySQL Database Connection - MySQL Connector Python
March 9, 2021 - You can also set the following Parameters of the MySQL server by executing SQL query from Python to handle the connection timeout issue. Change the following parameters’ value only when the connection_timeout argument alone can’t control the timeout issue. interactive_timeout: The number of seconds the server should wait for activity on an interactive connection before closing it. wait_timeout – Number of seconds the server should wait for activity on a connection before closing it. ... import mysql.connector from mysql.connector import Error try: connection = mysql.connector.connect(host='localhost', database='Electronics', user='pynative', password='pynative@#29', connection_timeout=180) if connection.is_connected(): db_Info = connection.get_server_info() print("Connected to MySQL database...
🌐
GeeksforGeeks
geeksforgeeks.org › python › connect-mysql-database-using-mysql-connector-python
Connect MySQL database using MySQL-Connector Python - GeeksforGeeks
July 19, 2025 - Conn_obj = mysql.connector.connect( host=<hostname>, user=<username>, passwd=<password>, database=<database_name> # optional ... Hostname: It represents the server name or IP address on which MySQL is running.
🌐
MySQL
dev.mysql.com › doc › connectors › en › connector-python-introduction.html
MySQL :: Connectors and APIs Manual :: 6.1 Introduction to MySQL Connector/Python
MySQL Connector/Python enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249).
🌐
Python.org
discuss.python.org › python help
How to connect MySQL database using Python (mysql.connector) remotely? - Python Help - Discussions on Python.org
December 16, 2021 - What I want to implement is a Python script that performs operations on a database. The database is hosted on a PC A [it is my personal PC (OS = Windows 10), on which I have installed XAMMP to manage a db (‘‘MySQL’’)]. Through phpMyAdmin I created 2 types of user: Root “type” user: with this user I can only access from the PC on which the DB is present (from “localhost”); Generic “type” user: with this user I want to access the DB on PC A, through the Python script, from any host (in alterna...
🌐
MySQL
dev.mysql.com › doc › connector-python › en › connector-python-example-cursor-select.html
MySQL :: MySQL Connector/Python Developer Guide :: 5.4 Querying Data Using Connector/Python
import datetime import mysql.connector cnx = mysql.connector.connect(user='scott', database='employees') cursor = cnx.cursor() query = ("SELECT first_name, last_name, hire_date FROM employees " "WHERE hire_date BETWEEN %s AND %s") hire_start = datetime.date(1999, 1, 1) hire_end = datetime.date(1999, 12, 31) cursor.execute(query, (hire_start, hire_end)) for (first_name, last_name, hire_date) in cursor: print("{}, {} was hired on {:%d %b %Y}".format( last_name, first_name, hire_date)) cursor.close() cnx.close()
🌐
Hex
hex.tech › home › blog › connecting to and querying mysql from python
Connecting to and querying MySQL from Python | Hex
November 14, 2022 - mysql-connector-python is the official python connector developed by MySQL and uses Python database API v2.0 specification. It gives you access to the latest version of MySQL and its functions.
🌐
Anaconda.org
anaconda.org › anaconda › mysql-connector-python
mysql-connector-python - anaconda | Anaconda.org
2 weeks ago - MySQL Connector/Python is a standardized database driver for Python platforms and development.