Reputation: 844
I have installed ejabberd on my localhost (WAMP) and its working properly for Mnesia database(default), Now I want to connect it with mysql but unable to do . I have tried with many link, example, Firstly created a database ejabberd with ejabberd schema and then 1. Commented the line,
From {auth_method, internal}.
To %%{auth_method, internal}.
after then,
FROM %%{auth_method, odbc}.
To
{auth_method, odbc}.
then,
%%
%% MySQL server:
%%
{odbc_server, {mysql, "localhost", "ejabberd", "root", "MyPassword"}}.
and finally added _odbc in some modules
{mod_last_odbc, []},
{mod_offline_odbc, []},
{mod_privacy_odbc, []},
{mod_private_odbc, []},
{mod_pubsub_odbc, [ % requires mod_caps ...
{mod_roster_odbc, []},
{mod_vcard_odbc, []},
But after these steps unable to start ejabberd server, i tried many times but all time i need to reinstall the ejabberd, even rollback of processes does not worked. Your help would be appreciable. Thanks in advance.
Upvotes: 1
Views: 4914
Reputation: 984
I wanted to give a updated answer, may be useful for later search.
In ejabberd.yml add to the end of the file
############## DATABASE CONFIGS ###########################
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "sqldatabasepassword"
sql_port: 3306
auth_method: sql
And to tell Ejabberd consider SQL database, add at the begining of the file after host or after log_rotate_count
default_db: sql
There you go you have connected your sql database to ejabberd. Make sure your database have schema required by ejabberd.
Upvotes: 0
Reputation: 890
I following this guide, and I am able to start server fine. When I am using $sudo ejabberdctl register user_1 localhost user_1 I got "User user_1@localhost successfully registered"
however, when I go to the database, "select * from users", I dont see any records, I also query all the tables, no see any data, all empty. Although I can login via the user_1/user_1 in XMPP client like Pidgin, any advice?
Thank you
Upvotes: 1
Reputation: 17757
step 1) Create database ejabberd
step 2)Import this schema to ejabberd database
step 3)open your configuration file(ejabberd.cfg) and make following changes
From {auth_method, internal}. To %%{auth_method, internal}. after then,
FROM %%{auth_method, odbc}.
To
{auth_method, odbc}.
then,
%%
%% MySQL server:
%%
{odbc_server, {mysql, "localhost", "ejabberd", "root", "MyPassword"}}.
Change mod_last to mod_last_odbc
Change mod_offline to mod_offline_odbc
Change mod_roster to mod_roster_odbc
Change mod_private to mod_private_odbc
Change mod_privacy to mod_privacy_odbc
Change mod_pubsub to mod_pubsub_odbc
Change mod_vcard to mod_vcard_odbc
step 4)This is where most people fumble.Install Erlang-Mysql drivers : http://svn.process-one.net/ejabberd-modules/mysql/trunk/
You can copy them to the same directory were all the other ejabberd beam files are already copied: /usr/lib/ejabberd/ebin/
step 5)Restart ejabberd.
Thats it.
Source :
https://www.ejabberd.im/Using%20ejabberd%20with%20MySQL%20native%20driver
https://www.ejabberd.im/node/4125
http://srijan.me/ejabberd-storing-data-in-mysql/
Upvotes: 1
Reputation: 551
Can you post your log statements to see what exactly is failing? I think you probably need to rebuild ejabberd with the --enable-odbc option.
Upvotes: 0