python3连接MySQL数据库出现报错:“AttributeError: 'str' object has no attribute 'decode”

在用python连接Mysql数据库的时候一直报这个错。

根据报错提示找到operations文件,打开之后找到下面这两行,然后注释掉。

#if query is not None:
#query = query.decode(errors='replace')

 

然后再重新打开pycharm去连接MySQL就可以正常连接不报AttributeError: 'str' object has no attribute 'decode错了

posted @ 2021-01-21 00:58  晨义  阅读(592)  评论(0)    收藏  举报