Simon Legner

MySQL connector for Python 3.3

Recently, I’ve been struggling to find a suitable MySQL connector for Python 3.3. Here’s what I figured:

The following pip packages provide MySQL support for Python 3.3:

You might also want to browse through other packages on PyPI.

For CyMySQL/PyMySQL3, a tiny documentation is available via GitHub. The package mysql-connector-python is documented on

Note that none of these packages seems to work with the older MySQL authentication:

For mysql-connector-python:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/mysql/connector/", line 44, in Connect
    return MySQLConnection(*args, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/mysql/connector/", line 108, in __init__
  File "/usr/local/lib/python3.3/site-packages/mysql/connector/", line 350, in connect
  File "/usr/local/lib/python3.3/site-packages/mysql/connector/", line 317, in _open_connection
  File "/usr/local/lib/python3.3/site-packages/mysql/connector/", line 163, in _do_auth
    "Authentication with old (insecure) passwords "
mysql.connector.errors.NotSupportedError: Authentication with old (insecure) passwords is not supported. For more information, lookup Password Hashing in the latest MySQL manual


Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/cymysql/", line 100, in Connect
    return Connection(*args, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/cymysql/", line 289, in __init__
  File "/usr/local/lib/python3.3/site-packages/cymysql/", line 453, in _connect
  File "/usr/local/lib/python3.3/site-packages/cymysql/", line 495, in _request_authentication
  File "/usr/local/lib/python3.3/site-packages/cymysql/", line 552, in _send_authentication
    data = _scramble_323(self.password.encode(self.charset), self.salt.encode(self.charset)) + int2byte(0)
AttributeError: 'bytes' object has no attribute 'encode'