Python MySQLdb通过自定义端口连接到Wamp服务器

问题描述 投票:0回答:1

我正在使用Wamp Server的MySQL。我必须通过在httpd.conf和httpd-vhosts中设置“Listens”将端口从80更改为8000。我可以通过浏览器访问phpMyAdmin(localhost:8000 / ...)但是当我尝试通过这样的程序连接时:

 dbConn = MySQLdb.connect(host='192.168.1.110',port=8000, user='root', passwd='', db='test')

它冻结了,在60秒后我收到错误:

super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 0")

在更换端口之前,它工作正常。

我该怎么办?提前致谢

编辑:当我将端口更改为3306并在skip-grant-tables取消注释行my.ini时,它可以工作

python-3.x wamp wampserver mysql-python port80
1个回答
0
投票

我想你改变了phpMyadmin端口,但你没有改变mysql的默认端口(3306)。

看到这里How to change the default port of mysql from 3306 to 3360

© www.soinside.com 2019 - 2024. All rights reserved.