Skip to main content

Python interface to MySQL

Project description

mysqlclient

This project is a fork of MySQLdb1. This project adds Python 3 support and fixed many bugs.

Support

Do Not use Github Issue Tracker to ask help. OSS Maintainer is not free tech support

When your question looks relating to Python rather than MySQL/MariaDB:

Or when you have question about MySQL/MariaDB:

Free threading Python

[!NOTE] The support for Free threading Python is experimental.

Since v2.2.8, free threading is supported when importing the extension module. Therefore, importing MySQLdb does not acquire GIL.

However, this library does not support simultaneous operations on a single Connection object from multiple threads, regardless of free threading, and the behavior in such cases remains undefined.

[!WARNING] Do not use a single Connection object from multiple threads simultaneously.

Install

Windows

Building mysqlclient on Windows is very hard. But there are some binary wheels you can install easily.

If binary wheels do not exist for your version of Python, it may be possible to build from source, but if this does not work, do not come asking for support. To build from source, download the MariaDB C Connector and install it. It must be installed in the default location (usually "C:\Program Files\MariaDB\MariaDB Connector C" or "C:\Program Files (x86)\MariaDB\MariaDB Connector C" for 32-bit). If you build the connector yourself or install it in a different location, set the environment variable MYSQLCLIENT_CONNECTOR before installing. Once you have the connector installed and an appropriate version of Visual Studio for your version of Python:

$ pip install mysqlclient

macOS (Homebrew)

Install MySQL and mysqlclient:

$ # Assume you are activating Python 3 venv
$ brew install mysql pkg-config
$ pip install mysqlclient

If you don't want to install MySQL server, you can use mysql-client instead:

$ # Assume you are activating Python 3 venv
$ brew install mysql-client pkg-config
$ export PKG_CONFIG_PATH="$(brew --prefix)/opt/mysql-client/lib/pkgconfig"
$ pip install mysqlclient

Linux

Note that this is a basic step. I can not support complete step for build for all environment. If you can see some error, you should fix it by yourself, or ask for support in some user forum. Don't file a issue on the issue tracker.

You may need to install the Python 3 and MySQL development headers and libraries like so:

  • $ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config # Debian / Ubuntu
  • % sudo yum install python3-devel mysql-devel pkgconfig # Red Hat / CentOS

Then you can install mysqlclient via pip now:

$ pip install mysqlclient

Customize build (POSIX)

mysqlclient uses pkg-config --cflags --ldflags mysqlclient by default for finding compiler/linker flags.

You can use MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS environment variables to customize compiler/linker options.

$ export MYSQLCLIENT_CFLAGS=`pkg-config mysqlclient --cflags`
$ export MYSQLCLIENT_LDFLAGS=`pkg-config mysqlclient --libs`
$ pip install mysqlclient

Documentation

Documentation is hosted on Read The Docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mysqlclient-2.2.8.tar.gz (92.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl (213.1 kB view details)

Uploaded CPython 3.14tWindows x86-64

mysqlclient-2.2.8-cp314-cp314-win_amd64.whl (211.6 kB view details)

Uploaded CPython 3.14Windows x86-64

mysqlclient-2.2.8-cp313-cp313-win_amd64.whl (207.2 kB view details)

Uploaded CPython 3.13Windows x86-64

mysqlclient-2.2.8-cp312-cp312-win_amd64.whl (207.2 kB view details)

Uploaded CPython 3.12Windows x86-64

mysqlclient-2.2.8-cp311-cp311-win_amd64.whl (206.9 kB view details)

Uploaded CPython 3.11Windows x86-64

mysqlclient-2.2.8-cp310-cp310-win_amd64.whl (206.9 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file mysqlclient-2.2.8.tar.gz.

File metadata

  • Download URL: mysqlclient-2.2.8.tar.gz
  • Upload date:
  • Size: 92.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8.tar.gz
Algorithm Hash digest
SHA256 8ed20c5615a915da451bb308c7d0306648a4fd9a2809ba95c992690006306199
MD5 e2b2b46d6159d06314ee5838c6d076eb
BLAKE2b-256 ebb09df076488cb2e536d40ce6dbd4273c1f20a386e31ffe6e7cb613902b3c2a

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 213.1 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 260cce0e81446c83bf0a389e0fae38d68547d9f8fc0833bc733014e10ce28a99
MD5 59e60b35eb4221b07e72bddd3a487158
BLAKE2b-256 66e5037d55623be9f681236e04abe12e1290847c06bd48270c3f19ac33493cbf

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 211.6 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9bed7c8d3b629bdc09e17fb628d5b3b0a5fd1f12b09432b464b9126c727bedc0
MD5 c90b37e34da9c85ecc81967c53975c58
BLAKE2b-256 42446ae21b4e8490eb5167d04fa7452c462ffd72a502b96bf531477ef044a380

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 207.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a81f5e12f8d05439709cb02fba97f9f76d1a6c528164f2260d8798fec969e300
MD5 3de90975ac28e6c158c7359531ecd4ff
BLAKE2b-256 e6d576e369b0fdccd2eb9ed7d890e4e3e23aa1344fea62f0180d7f1574285e54

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 207.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 000c7ec3d11e7c411db832e4cfcd7f05db47464326381f5d5ae991b4bb572f93
MD5 7d46d4b62c473400b1f1b5004118a789
BLAKE2b-256 db1f7d6b3fbfc8a317805fdb8bbfbc23af99f2090497090e82513daf491a29ce

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 206.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 60c9ed339dc09e3d5380cc2a9f42e86754fee25a661ced77a02df77990664c92
MD5 c2bc0e3fab83721d3c081b6ed53c0c3f
BLAKE2b-256 44f66253d116c024aeb11fb193ad14e2bae2bd3380690e885028abf798b1b0b4

See more details on using hashes here.

File details

Details for the file mysqlclient-2.2.8-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mysqlclient-2.2.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 206.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mysqlclient-2.2.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 86db31bba7b3480fec2751350e9790e24f016f89af33a87bab7e79f7196474e8
MD5 c54fb6536f4b25cd03384ee4bc11d67c
BLAKE2b-256 60d022b896a2f8f797ee3517a0c1c1fe576cd38768cd25e2a7362a7277725ed4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page