pymysql.err.OperationalError:2003年,“无法连接到'localhost'上的MySQL服务器[Errno 111]连接被拒绝”

问题描述

我当前正在使用MysqL@R_502_6274@构建一个机器人,并且试图在heroku上运行它。但是,由于我的主机名是localhost,@R_502_6274@拒绝连接到@R_502_6274@。如何使MysqL@R_502_6274@连接到heroku?

更多信息,如果您需要更多信息:

我做了一些研究,发现我需要将MysqL@R_502_6274@主机名更改为0.0.0.0,以使其可以连接到任何地方。但是我不知道应该使用哪个端口。有人可以帮我吗?如何将heroku discord bot连接到@R_502_6274@并使其运行?这是完整的heroku日志错误

2020-08-18T13:45:40.371647+00:00 heroku[worker.1]: State changed from starting to up
2020-08-18T13:45:43.831500+00:00 app[worker.1]: Traceback (most recent call last):
2020-08-18T13:45:43.831536+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/sit
e-packages/pyMysqL/connections.py",line 571,in connect
2020-08-18T13:45:43.831919+00:00 app[worker.1]: **kwargs)
2020-08-18T13:45:43.831924+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/soc
ket.py",line 724,in create_connection
2020-08-18T13:45:43.832413+00:00 app[worker.1]: raise err
2020-08-18T13:45:43.832418+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/soc
ket.py",line 713,in create_connection
2020-08-18T13:45:43.832917+00:00 app[worker.1]: sock.connect(sa)
2020-08-18T13:45:43.832945+00:00 app[worker.1]: ConnectionRefusedError: [Errno 111] Connect
ion refused
2020-08-18T13:45:43.832949+00:00 app[worker.1]:
2020-08-18T13:45:43.832950+00:00 app[worker.1]: During handling of the above exception,ano
ther exception occurred:
2020-08-18T13:45:43.832950+00:00 app[worker.1]:
2020-08-18T13:45:43.832953+00:00 app[worker.1]: Traceback (most recent call last):
2020-08-18T13:45:43.832980+00:00 app[worker.1]: File "sky_rpg.py.py",line 15,in <module>
2020-08-18T13:45:43.833120+00:00 app[worker.1]: cursorclass=pyMysqL.cursors.DictCursor)
2020-08-18T13:45:43.833124+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/sit
e-packages/pyMysqL/__init__.py",line 94,in Connect
2020-08-18T13:45:43.833306+00:00 app[worker.1]: return Connection(*args,**kwargs)
2020-08-18T13:45:43.833310+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/sit
e-packages/pyMysqL/connections.py",line 327,in __init__
2020-08-18T13:45:43.833580+00:00 app[worker.1]: self.connect()
2020-08-18T13:45:43.833585+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/sit
e-packages/pyMysqL/connections.py",line 619,in connect
2020-08-18T13:45:43.833985+00:00 app[worker.1]: raise exc
2020-08-18T13:45:43.834012+00:00 app[worker.1]: pyMysqL.err.OperationalError: (2003,"Can't
 connect to MysqL server on 'localhost' ([Errno 111] Connection refused)")
2020-08-18T13:45:43.963849+00:00 heroku[worker.1]: Process exited with status 1
2020-08-18T13:45:44.028829+00:00 heroku[worker.1]: State changed from up to crashed

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)