我正在使用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
时,它可以工作
我想你改变了phpMyadmin端口,但你没有改变mysql的默认端口(3306)。
看到这里How to change the default port of mysql from 3306 to 3360