Virtual Package for MySQL-python (Deprecated)

0.0.3 · deprecated · verified Wed Apr 15

The `mysql` package on PyPI is a virtual package, currently at version 0.0.3. It does not provide actual MySQL connectivity. Its primary purpose, especially for version 0.0.3, is to raise a `RuntimeError` upon installation or import, directing users to install proper MySQL client libraries like `mysqlclient` or `PyMySQL` directly. It has a very slow release cadence, with the last update in May 2021, and serves as a placeholder to guide users away from outdated dependencies.

Warnings

Install

Quickstart

The `mysql` package itself does not offer a quickstart because its intended behavior is to prevent usage and guide developers to a suitable, actively maintained MySQL connector. The code provided illustrates the typical usage patterns for recommended alternatives like `mysqlclient` (which uses `MySQLdb` for imports) or `PyMySQL`.

# The 'mysql' package (0.0.3) does not provide a functional API.
# It will raise a RuntimeError upon import or use, directing you to install
# 'mysqlclient' or 'PyMySQL' instead.
# For example, to use mysqlclient:
# pip install mysqlclient
# import MySQLdb
# conn = MySQLdb.connect(host='localhost', user=os.environ.get('MYSQL_USER', 'user'), password=os.environ.get('MYSQL_PASSWORD', 'password'), database=os.environ.get('MYSQL_DATABASE', 'test_db'))
# cursor = conn.cursor()
# cursor.execute('SELECT VERSION()')
# print(cursor.fetchone())
# conn.close()

# Or to use PyMySQL:
# pip install PyMySQL
# import pymysql
# connection = pymysql.connect(host='localhost', user=os.environ.get('MYSQL_USER', 'user'), password=os.environ.get('MYSQL_PASSWORD', 'password'), database=os.environ.get('MYSQL_DATABASE', 'test_db'))
# with connection.cursor() as cursor:
#     cursor.execute('SELECT VERSION()')
#     print(cursor.fetchone())
# connection.close()

view raw JSON →