Ejabberd 无法连接到“localhost”:3306:错误,“连接失败:连接被拒绝”
Posted
技术标签:
【中文标题】Ejabberd 无法连接到“localhost”:3306:错误,“连接失败:连接被拒绝”【英文标题】:Ejabberd Failed connecting to "localhost":3306 : error,"connect failed: connection refused"Ejabberd 无法连接到“localhost”:3306:错误,“连接失败:连接被拒绝” 【发布时间】:2020-03-25 20:44:03 【问题描述】:我正在尝试使用mysql
设置ejabberd
。每次都是localhost:3306: connection refused error
。有什么解决办法吗?
环境
ejabberd version: 19.09
OS: Linux (Debian)
Installed from: source
mysql的配置部分
auth_method: sql
default_db: sql
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "ejabberd"
sql_port: 3306
错误日志
2019-11-30 22:44:49.117 [error] <0.449.0>@ejabberd_sql:log:1043 p1_mysql_recv: Failed connecting to localhost:3306: connection refused
2019-11-30 22:44:49.117 [error] <0.450.0>@ejabberd_sql:log:1043 p1_mysql_recv: Failed connecting to localhost:3306: connection refused
2019-11-30 22:44:49.117 [error] <0.431.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.432.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.433.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.434.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.435.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.436.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.437.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.438.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.439.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.440.0>@ejabberd_sql:log:1043 p1_mysql_conn: Failed connecting to "localhost":3306 : error,"connect failed: connection refused"
2019-11-30 22:44:49.117 [error] <0.421.0>@ejabberd_sql:log:1043 p1_mysql_conn: post_start error connect_failed
2019-11-30 22:44:49.117 [error] <0.427.0>@ejabberd_sql:log:1043 p1_mysql_conn: post_start error connect_failed
error.log/crash.log 中的错误
2019-11-30 22:36:58 =CRASH REPORT====
crasher:
initial call: mod_mqtt:init/1
pid: <0.525.0>
registered_name: []
exception exit: db_failure,[gen_server,init_it,6,[file,"gen_server.erl",line,349],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,247]]
ancestors: [ejabberd_gen_mod_sup,ejabberd_sup,<0.88.0>]
message_queue_len: 0
messages: []
links: [<0.403.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 987
stack_size: 27
reductions: 1073
neighbours:
【问题讨论】:
你安装了 MySQL 服务器吗?它的日志是怎么说的? 是的,我已经安装了mysql 我看到 mysql 日志连接正在连接到 MySQL,但它不允许。它看起来是最大包大小问题。 错误信息是什么? Mysql 日志说Error Reading Communication Packets
。我想将max_allowed_packet
调整为更大的尺寸
【参考方案1】:
-
可能连接随机丢失
可能无法访问
试试下面的
mysql -u ejabberd -h localhost -p password
【讨论】:
【参考方案2】:问题来自mysql
。我在mysql log
文件中找到了它。我将max_allowed_packet
增加到更大的尺寸,然后增加了RAM
,一切都很好。
【讨论】:
以上是关于Ejabberd 无法连接到“localhost”:3306:错误,“连接失败:连接被拒绝”的主要内容,如果未能解决你的问题,请参考以下文章
使用 strophe 和 ejabberd bosh 连接到 localhost 上的 jid 帐户时连接失败