Discuss / Python / pymysql.err.InternalError: (1043, 'Bad handshake')问题

pymysql.err.InternalError: (1043, 'Bad handshake')问题

Topic source

Jason_K_Ying

#1 Created at ... [Delete] [Delete and Lock User]

谢谢廖老师的教程,对我帮助很大。

还想冒昧的请问一下廖老师,按照day16的源码部署到服务器(ubuntu 16.04 LTS)上后,用pycharm运行项目总是报错连接mysql超时:

File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 447, in _connect yield from self._request_authentication() File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 615, in _request_authentication auth_packet = yield from self._read_packet() File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 500, in _read_packet packet.check_error() File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 394, in check_error err.raise_mysql_exception(self._data) File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception _check_mysql_exception(errinfo) File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py", line 115, in _check_mysql_exception raise InternalError(errno, errorvalue) pymysql.err.InternalError: (1043, 'Bad handshake')

我很严格的检查了config_default.py和config_override.py中与db有关的参数设置,确认无误,又按照mysql-5.6的manual逐一排除了所有造成连接不上的可能性: 1.后台mysqld没有运行; 2.mysql账户的用户名/密码错误; 3.端口3306失效(被占用/被修改); 4.mysqld.sock失效(损坏/更改路径/访问权限不足); 5.linux防火墙阻止访问本机端口3306

依旧无法解决,然后重装mysql问题仍旧重现,可否请问廖老师是哪一步出现了问题?

祝廖老师工作顺利,阖家幸福!

Jason_K_Ying

#2 Created at ... [Delete] [Delete and Lock User]

对了,下载的awesome-python3-webapp-day-15.zip安装包中,awesome-python3-webapp-day-15\www\app.py的第115行报错,原因是 t 没有声明。

Jason_K_Ying

#3 Created at ... [Delete] [Delete and Lock User]

尽了绵薄之力,支持廖老师继续写出优质教程

Jason_K_Ying

#4 Created at ... [Delete] [Delete and Lock User]

自问自答:

问题解决: 将aiomysql 0.0.7 (对应PyMySQL0.7.2)卸载后重装为: aiomysql 0.0.7 (对应PyMySQL 0.6.7)问题解决。 为找这个问题花了2个晚上的业余时间,也是醉了。


  • 1

Reply