I run MySQLdb v1.2.3 and get the following error:
LookupError: unknown encoding: utf8mb4
This answer suggests updating MySQLdb to version 1.2.5. I updated and now get this error:
ImportError: this is MySQLdb version (1, 2, 5, 'final', 1), but _mysql is version (1, 2, 3, 'final', 0)
I'm not sure how to upgrade to _mysql
or how this will change my setup. Is it just a python module or is it somehow connected to my MySQL server?
EDIT: I tried using the following three methods:
sudo pip uninstall mysql-python sudo pip install mysql-python sudo pip uninstall mysql-python sudo pip install mysql-python==1.2.5 sudo pip install mysql-python
When uninstall I get
/usr/local/lib/python2.7/dist-packages/_mysql.so /usr/local/lib/python2.7/dist-packages/_mysql_exceptions.py /usr/local/lib/python2.7/dist-packages/_mysql_exceptions.pyc Proceed (y/n)? y Successfully uninstalled MySQL-python-1.2.3
After that, I cannot import MySQLdb
or _mysql
, but reinstalling always gives me _mysql
version 1.2.3.
SECOND EDITING / SOLUTION: Turns _mysql
was installed in two different places on the server. Uninstallation / installation, as mentioned above, updated _mysql
to v1.2.5, but whenever I imported MySQLdb
, priority was given to another version of _mysql
that was not affected by pip.