[ejabberd] Ejabberd refusing to use mysql

Ryan Churches ryan.churches at gmail.com
Sat Jan 19 06:44:46 MSK 2008

Hi everyone,
Ive tried the chat room and the mailing list with no luck, so I'm hoping
someone out there will be able to help me.

Im using gentoo linux, 2.6 kernel, x86 arch, on a Xen slice.  I can get
ejabberd installed, and running, but once I try to use MySQL for my user
registry, everything breaks.  Users cannot log in (clients say "Not
Authorized"), I cannot create users via ejabberct; (says:  User already
exists at node), and creating an account from an XMPP client results in
"409:  Conflict."

As I mentioned I followed the HowTo pretty closely, and got ejabberd working
using the internal db pretty easily.  i just set the {hosts} directive, and
replace all references to ./ssl.pem to /etc/jabber/ssl.pem, because ejabberd
wont work without the full path there.

Then I proceed directly to the Native MySQL HowTo, and make the few changes
it suggests there.

I've enabled my sql logs, and I can see that ejabberd never communicates
with the MySQL service.

In addition, as per a suggestion, I added some debugging output to

try_register(User, Server, Password) ->
    ?INFO_MSG("Lets start with the function try_register with ~n User: ~p,
Server: ~p, Password: ~p", [User, Server, Password]),
    case jlib:nodeprep(User) of
        error ->
            ?INFO_MSG("Error: invalid JID; with user: ~p", [User]),
            {error, invalid_jid};
        LUser ->
            ?INFO_MSG("OK, nodeprep returns LUser: ~p", [LUser]),
            Username = ejabberd_odbc:escape(LUser),
            Pass = ejabberd_odbc:escape(Password),
            LServer = jlib:nameprep(Server),
            ?INFO_MSG("So, let's call add_user with ~n LServer: ~p,
Username: ~p, Pass: ~p", [LServer, Username, Pass]),
            case catch odbc_queries:add_user(LServer, Username, Pass) of
                {updated, 1} ->
                    ?INFO_MSG("Success creating the account!!", []),
                    {atomic, ok};
                _ ->
                    ?INFO_MSG("Error creating the account :(  Maybe the
account already exists ~n Result: ~p", []),
                    {atomic, exists}
...but i never see anything pop up in ejabberd.log, so this leads me to
believe that not only is ejabberd not communicating with the MySQL server,
but that it doesn't even know its supposed to try, as this code is never
being called.  Either that, or I'm looking in the wrong place for the debug
output.  (DISCLAIMER:  I am no erlang expert)

Here is the dif between the ejabberd.cfg.example and my completed
ejabberd.cfg upon completion of the tutorial when everything should be

< {auth_method, internal}.
> % {auth_method, internal}.

< %{auth_method, odbc}.
< %{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"}.

> {auth_method, odbc}.
> {odbc_server, {mysql, "localhost", "FQDN_XMPP", "ejabberd", "secret"}}.

< {hosts, ["localhost"]}.
> {hosts, ["FQDN.com"]}.

<                           starttls, {certfile, "./ssl.pem"}]},
>                           starttls, {certfile, "/etc/jabber/ssl.pem"}]},

<                           tls, {certfile, "./ssl.pem"}]},
>                           tls, {certfile, "/etc/jabber/ssl.pem"}]},

< {s2s_certfile, "./ssl.pem"}.
> {s2s_certfile, "/etc/jabber/ssl.pem"}.

<   {mod_roster,     []},
>   {mod_roster_odbc,     []},

<   {mod_vcard,      []},
>   {mod_vcard_odbc,      []},

<   {mod_offline,    []},
>   {mod_offline_odbc,    []},

<   {mod_last,       []},
>   {mod_last_odbc,       []},

Any help is much appreciate,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jabber.ru/pipermail/ejabberd/attachments/20080118/f042f030/attachment.htm 

More information about the ejabberd mailing list