Question

I actually found a blog post that pretty much sums up my problem. Its at

http://simon04.net/2013/03/python3-mysql/

The blog post is the most clear but to summarize: I'm currently trying to access a remote MySQL database with a python package called PyMySQL3. However I keep getting the error: "AttributeError: 'bytes' object has no attribute 'encode'". From the blog post above and some other research, I think this has to do with my database having an old authentication method.

However, I'm confused because it looks like the old authentication method was phased out sometime in MySQL 4.0. The database I have runs MySQL 5.0.51a. Shouldn't my database have the correct authentication?

I've been working on this awhile and getting a little frustrated. Hopefully someone can help. Thanks,

Was it helpful?

Solution 2

Ok, while investigating this more I thought that maybe my hosting company (aplus.net) just wasn't up to date. I was going to switch companies anyways and so I opened a new account with another company. Now I have no problems connecting with PyMySQL3. So apparently, my old hosting company just wasn't up to date or at least their sql configuration was breaking PyMySQL3.

Thanks for your reponse though. Hopefully not many other people have this issue because switching hosting companies isn't always the best answer =O

OTHER TIPS

From https://github.com/petehunt/PyMySQL/issues/64

For me this problem was due to the usage of the old authentication method (cf. http://dev.mysql.com/doc/internals/en/authentication-method.html). Creating a new user (resetting the password might work as well) and making sure that the password column for this user in the mysql.user table starts with a * (otherwise check the server configuration according to the above link), solved the problem for me.

Have you created the users with this very Version you mentioned?

The thread shows how to fix the problem in the code aswell, tellme when you need additional help to fix it. I would edit my answer accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top