Skip to main content

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

Metadata

Release files for mysqlclient 2.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysqlclient 2.2.8
File Size Uploaded
mysqlclient-2.2.8.tar.gz 92.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mysqlclient 2.2.8
File
mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
mysqlclient-2.2.8-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
mysqlclient-2.2.8-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
mysqlclient-2.2.8-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
mysqlclient-2.2.8-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
mysqlclient-2.2.8-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details

Total release size: 1.3 MB

Release files / mysqlclient-2.2.8.tar.gz

Download URL mysqlclient-2.2.8.tar.gz
Size 92.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ed20c5615a915da451bb308c7d0306648a4fd9a2809ba95c992690006306199
BLAKE2b-256 checksum
How to use checksums
ebb09df076488cb2e536d40ce6dbd4273c1f20a386e31ffe6e7cb613902b3c2a
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl

Download URL mysqlclient-2.2.8-cp314-cp314t-win_amd64.whl
Size 213.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
260cce0e81446c83bf0a389e0fae38d68547d9f8fc0833bc733014e10ce28a99
BLAKE2b-256 checksum
How to use checksums
66e5037d55623be9f681236e04abe12e1290847c06bd48270c3f19ac33493cbf
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp314-cp314-win_amd64.whl

Download URL mysqlclient-2.2.8-cp314-cp314-win_amd64.whl
Size 211.6 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
9bed7c8d3b629bdc09e17fb628d5b3b0a5fd1f12b09432b464b9126c727bedc0
BLAKE2b-256 checksum
How to use checksums
42446ae21b4e8490eb5167d04fa7452c462ffd72a502b96bf531477ef044a380
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp313-cp313-win_amd64.whl

Download URL mysqlclient-2.2.8-cp313-cp313-win_amd64.whl
Size 207.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a81f5e12f8d05439709cb02fba97f9f76d1a6c528164f2260d8798fec969e300
BLAKE2b-256 checksum
How to use checksums
e6d576e369b0fdccd2eb9ed7d890e4e3e23aa1344fea62f0180d7f1574285e54
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp312-cp312-win_amd64.whl

Download URL mysqlclient-2.2.8-cp312-cp312-win_amd64.whl
Size 207.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
000c7ec3d11e7c411db832e4cfcd7f05db47464326381f5d5ae991b4bb572f93
BLAKE2b-256 checksum
How to use checksums
db1f7d6b3fbfc8a317805fdb8bbfbc23af99f2090497090e82513daf491a29ce
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp311-cp311-win_amd64.whl

Download URL mysqlclient-2.2.8-cp311-cp311-win_amd64.whl
Size 206.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
60c9ed339dc09e3d5380cc2a9f42e86754fee25a661ced77a02df77990664c92
BLAKE2b-256 checksum
How to use checksums
44f66253d116c024aeb11fb193ad14e2bae2bd3380690e885028abf798b1b0b4
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mysqlclient-2.2.8-cp310-cp310-win_amd64.whl

Download URL mysqlclient-2.2.8-cp310-cp310-win_amd64.whl
Size 206.9 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
86db31bba7b3480fec2751350e9790e24f016f89af33a87bab7e79f7196474e8
BLAKE2b-256 checksum
How to use checksums
60d022b896a2f8f797ee3517a0c1c1fe576cd38768cd25e2a7362a7277725ed4
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

2.3.0

17 release files

This release

2.2.8 This release

7 release files

2.2.7

8 release files

2.2.6

8 release files

2.2.5

8 release files

2.2.4

9 release files

2.2.3

9 release files

2.2.2

9 release files

2.2.1

9 release files

2.2.0

7 release files

2.1.1

7 release files

2.1.0

5 release files

2.0.3

5 release files

2.0.2

5 release files

2.0.1

4 release files

2.0.0

4 release files

1.4.6

4 release files

1.4.5

3 release files

1.4.4

3 release files

1.4.3

1 release file

1.4.2

1 release file

1.4.1

3 release files

1.4.0

3 release files

1.3.13

1 release file

1.3.10

5 release files

1.3.9

3 release files

1.3.8

1 release file

1.3.7

3 release files

1.3.6

5 release files

1.3.5

1 release file

1.3.4

5 release files

1.3.3

5 release files

1.3.2

1 release file

1.3.1

5 release files

1.3.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page