Registry / database / mysql
library0.0.3pypypiunverified

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.

pip install mysql
INSTALL
IMPORT
SIG · MYSQL
M
mysql
databasepythonv0.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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()
Debug
Known issues
breakingThe `mysql` package (version 0.0.3 and later) does not provide any functionality. Attempting to import or use it will raise a `RuntimeError`, explicitly instructing users to install `mysqlclient` or `PyMySQL` instead.
fix
Do not depend on `mysql`. Instead, install and use `mysqlclient` (for C-extension based driver, `pip install mysqlclient`) or `PyMySQL` (for pure Python driver, `pip install PyMySQL`).
affects: 0.0.3+
gotchaUsers often install `mysql` expecting it to be a functional MySQL connector. However, it is a virtual package designed to redirect, not implement, database connectivity. Older versions (pre-0.0.3) might have attempted to install `MySQL-python` (Python 2 only) or `mysqlclient` as a dependency, leading to inconsistent behavior.
fix
Always explicitly choose and install a maintained MySQL connector like `mysqlclient` or `PyMySQL`. Check their respective PyPI pages and documentation for current installation and usage instructions.
affects: All versions
deprecatedThe practice of using a 'virtual package' like `mysql` to indirectly manage dependencies is largely deprecated. Direct dependency management is preferred for clarity and stability.
fix
Update `requirements.txt` or `pyproject.toml` to directly list `mysqlclient` or `PyMySQL` as dependencies.
affects: All versions
gotchaThe `MySQL-python` library, which older versions of this virtual package historically pointed to, is a Python 2-only library and is largely unmaintained. It will not work with Python 3 environments.
fix
For Python 3, use `mysqlclient` or `PyMySQL`. If you strictly require `MySQL-python` (e.g., for a legacy Python 2 application), ensure your environment is Python 2 compatible and understand that `MySQL-python` is not actively developed.
affects: <0.0.3 (indirectly), Python 2 users
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mysql'
Developers often install the placeholder 'mysql' package from PyPI, which does not provide an actual 'mysql' module, and then attempt to import 'mysql' or 'mysql.connector' assuming it was installed.
fix
Install a proper MySQL client library such as 'mysql-connector-python', 'mysqlclient', or 'PyMySQL' (e.g., `pip install mysql-connector-python`).
import mysql
Developers mistakenly try to import 'mysql' directly, expecting it to be the main module for MySQL connectivity, rather than specific, separately installed client libraries like 'mysql.connector' or 'PyMySQL'.
fix
After installing a proper MySQL client (e.g., `pip install mysql-connector-python`), import the specific connector module (e.g., `import mysql.connector`).
fatal error: my_config.h: No such file or directory
This error occurs during the installation of 'mysqlclient', a C extension, because the MySQL client development headers and libraries, which are required for compilation, are missing on the system.
fix
Install the MySQL development headers specific to your operating system. For Debian/Ubuntu, use `sudo apt-get install libmysqlclient-dev`; for macOS, use `brew install mysql-client`; for Windows, install the MySQL Connector/C++ Development Headers.
ERROR: Failed building wheel for mysqlclient
This general build error when installing 'mysqlclient' typically indicates that necessary system-level dependencies, such as MySQL development headers, 'pkg-config', or a C compiler, are missing and required to compile the C extension.
fix
Ensure all required build tools and MySQL client development headers are installed on your system (e.g., `sudo apt-get install build-essential libmysqlclient-dev` on Debian/Ubuntu, install Xcode command line tools and MySQL client on macOS, or Visual C++ build tools and MySQL Connector/C++ on Windows).
Upgrade
Version history
0.0.3latest on PyPI · released May 25, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
mysql — pip install mysql · libregistry