1

Working on a python app on Mac (Yosemite OSX 10.10) I ran into this issue:

OperationalError: (2049, "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)")

With a bit of research it seemed that my client (that is mysql-python) is using secure auth and the user had a password encrypted in an old style, that is prior to pre-4.1.1.

As I do not have ways to handle things on the DB side I was wondering if there was a workaround or a way to deactivate secure_auth on mysql-python?

AKFourSeven
  • 1,305
  • 3
  • 18
  • 31

2 Answers2

2

I am adapting the answer from here:

Eventually you have to tell the client who has an old-style password to change it to a new-style password. Old passwords are not secure.

Now, you are getting the error since the client has secure_auth set, but they have an old password. In order to login with the old password, the client must disable secure_auth on the client side. How exactly you do this varies by which client you're using.

Some other workarounds can be found in the MySQL documentation: Client does not support authentication protocol

Community
  • 1
  • 1
  • I have seen this answer but there was no resource regarding python so I am back to square one. You are qui right about the user and its old style password but I am not in charge of the DB and cannot do/advocate/suggest this change at all. – AKFourSeven Jan 23 '15 at 15:17
  • If you use MySQL Workbench, in the Manage Server Connections, Connection tab, Advanced sub-tab, you can check the box 'Use the old authentication protocol.' and then it should be working for you –  Jan 23 '15 at 15:28
  • again I am not managing the mysql, I have little liberty on that side, I can merely make calls to the DB through python which uses mysql-python to make the call to the database. – AKFourSeven Jan 23 '15 at 15:31
  • 1
    Then according to [this](http://stackoverflow.com/questions/26726956/is-there-a-way-to-set-secure-auth-to-false-in-mysqldb-connect-in-python-2-7-5), there shouldn't be any way to fix it –  Jan 23 '15 at 15:36
  • Aaw... okay well I will check for the ticket being raised there and see if anything is done on it! – AKFourSeven Jan 23 '15 at 15:43
0

I found a cure!

Or rather a workaround. From this post I decided to select slightly older version of MySQL and MySQLdb and this solved the issue.

Here is how I did it:

I had previously installed mysql_python for my python and had the brew version of mysql installed.

I deteleted all of that.

I look for a way to install MySQLdb by looking for it last stable version with the source.

I compiled them (followed the isntructions here), installed them and then I looked for a stable version of MySQL client (MySQL website is the best place for that) and install the 5.5 version which was perfectly fitting my requirements.

I made mysql to launch itself automatically and then restarted my computer (but you can just restart apache) and check that all path were correct and the right includes are in the right places (you can check that against the link above).

And now it all works fine!

Hope it helps.

Community
  • 1
  • 1
AKFourSeven
  • 1,305
  • 3
  • 18
  • 31