Ejabberd无法连接到“ localhost”:3306:{错误,“连接失败:连接被拒绝”}

时间:2019-11-30 17:29:08

标签: mysql erlang xmpp ejabberd mnesia

我正在尝试将ejabberd设置为MySQL。每次都有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:

2 个答案:

答案 0 :(得分:0)

  1. 也许连接随机丢失
  2. 可能无法访问
  3. 尝试以下mysql -u ejabberd -h localhost -p password

答案 1 :(得分:0)

问题出在mysql。我在mysql log文件中找到了它。我把max_allowed_packet增大到一个更大的尺寸,然后把RAM增大了。