Skip to main content

The starting point is to read through and follow the notes outlined on the ejabberd site regarding adding database schema.  The purpose of this documentation is to clarify where the files were located for me.

The schema files can be found in ejabberd priv directory.  To find the priv directory, use the find command

find / -name priv -type d

Initially, the directory I found based on the guidelines

PREFIX/lib/ejabberd-VERSION/priv/sql

Was

/usr/local/lib/ejabberd-19.02.52/priv/sql

However, the only file in this directory was lite.sql.  Do not use this file.

I couldn't the mysql.sql file.  So I did a search command specifically for mysql.sql

sudo find / -name "mysql.sql"

Conducting the search this way showed where the files were, interestingly it didn't quite match the criteria outlined earlier PREFIX/lib/...

The directory that had the correct mysql.sql file was

/opt/ejabberd-19.02/lib/ejabberd-19.02/priv/sql

Otherwise, you can by pass this and download the schema

wget https://raw.githubusercontent.com/processone/ejabberd/master/sql/mysql.sql

Install the schema 

mysql -h localhost/IP_Address -D ejabberd -u ejabberd -p < mysql.sql

Edit the config file /usr/local/etc/ejabberd/ejabberd.yml to make necessary changes

Change the authentication method

auth_method: sql

Use mysql for all the modules:

default_db: sql

Specify the details of the mysql database

sql_type: mysql
sql_server: "IP address or localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "password"
## If you want to specify the port:
sql_port: 3306