pythonmysqlsqlalchemymysql-5.1

Interacting with MySQL 5.1 database from computer with MySQL 8 via python/SQLAlchemy


I just updated my system from Ubuntu 19.1 to 20.02 - and it looks like all the previous MySQL settings got wiped out.

Current system has MySQL 8 (server + client) installed.
The server I am trying to access has MySQL 5.1.

Every time I try to connect using SqlAlchemy, I get the following error:

sqlalchemy.exc.OperationalError: (mysql.connector.errors.OperationalError) 1043 (08S01): Bad handshake

From what I read - this error happens because the server I'm attempting to connect to is running version of MySQL that is too old.

Is there a way to downgrade MySQL connector, to fix the connection issue?


Solution

  • I was able to make this work by uninstalling newest connector:

    sudo pip3 uninstall mysql-connector-python
    

    Then installing an older version of the connector:

    sudo pip3 install -Iv mysql-connector-python==8.0.5
    

    To check your connector version, you can use:

    pip3 show mysql-connector-python