By default Ejabberd uses mnesia database and if you are not familiar with this then ejabberd provides many other database options for you. You can connect with anyone of them in which you are comfortable. The advantage of connecting ejabberd with your familiar database is that you can read data in database and can create your own web services for reporting and other purposes.
I am going to explain here how can we use ejabberd with mysql.
If you are installing ejabberd from source code then you have to pass mysql option when you configure ejabberd. Follow below steps to configure ejabberd source with mysql option.
Now you need mysql server where you can point your ejabberd configuration. ejabberd make use of FULLTEXT indexes with InnoDB. Thus, you need MySQL 5.6 or greater to use with ejabberd.
You can find latest schema of ejabberd database from here.
Now load this database schema into your database.
Now in ejabberd configuration file /etc/ejabberd/ejabberd.yml we have to update mysql configuration.
Change auth method internal to odbc.
And change below configuration as well.
# If you want to specify the port:
Now you have configured your ejabberd with mysql. Now create a new admin user and start using ejabberd.
Change modules to use MySQL instead of Mnesia:
Whatever steps we followed so far only ejabberd authentication is moved from mnesia to mysql, other modules are still using internal database. To globally move default database to mysql add below configuration in your ejabberd.yml.