How to fix Django OperationalError /admin/auth/user/add/ SAVEPOINT …_x1 does not exist

This is a weird one, an error I had never got until I used an external MySQL (Maria) DB Instance with Django.

The steps to recreate this error would be:

  1. As an Admin try and add another user from the admin section

You will get an error like this:

OperationalError /admin/auth/user/add/
error(1305, 'SAVEPOINT s139787825936192_x1 does not exist')

In my case the system had the following attributes:

  • CentOS 7
  • python mysql connecor: mysqlclient
  • django 2.2.15
  • Server version: 5.5.30 (ProxySQL)

According to this stackoverflow post on the subject, it was to do with the MySQL-Python connector.

The answerer recommends using the mysqlclient python package. Thing is…I am using it.

What I Tried

  • Upgrading to django 3
  • Downloading and installing the lastest python MySQL connectors
  • Installing mariadb libs locally on the app server
  • Uninstall mysqlclient package and use pip install PyMySQL
  • Downgrade from mysqlclient==2.0.0. to mysqlclient==1.4.6

What Worked

I moved to using a local database:

Server version: 10.5.4-MariaDB MariaDB Server