Search code examples
erlangxmppejabberd

Ejabberd roster with mysql


I am using exauth with ejabberd to authenticate my users, but I want to use mysql to store user information, such as GROUPS, rosters etc.

Here is my configuration.

{auth_method, external}.
{extauth_program, "/home/hitesh/ejabberd_auth.php"}.

{host_config, "subdomain.nodyssey.com", [{auth_method, [external, anonymous]}]}.

{odbc_server, {mysql, "localhost","ejabberd", "root", "root"}}.

the mysql database is EMPTY! users still have roster and chat history on group chat,so looks like mnesia database is being used! How do I switch to mysql for this?

what am I doing wrong?


Solution

  • user601836's correct. I misunderstood the question initially. Assuming that odbc and mysql driver are properly installed, here is the updated answer:

    1. Have you created the mysql tables to store the roster data, etc? Also are all of your ejabberd tables created using innodb engine? You can get the schema in github: https://github.com/processone/ejabberd/blob/2.1.x/src/odbc/mysql.sql. Also you can find it in your ejabberd installation folder. Mine is in this location: ejabberd_installation_root/lib/ejabberd-2.1.11/priv/sql/mysql.sql.
    2. Replace related module names using the *_odbc one in your ejabberd.cfg. For example, replace mod_roster to mod_roster_odbc, replace mod_muc to mod_muc_odbc. A number of odbc supported modules are listed here:
      ...
      {mod_offline_odbc,  []},
      {mod_last_odbc,     []},
      {mod_roster_odbc,   []},
      {mod_shared_roster_odbc,[]},
      {mod_vcard_odbc,    []},
      {mod_muc_odbc, [
        ...]},
      {mod_pubsub_odbc, [
        ...]},
      ...

    For the detailed module information, check the official doc:

    https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.11/doc/guide.html#modoverview