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

Related articles

Andrew Fletcher27 Jul 2023
Exporting a MySQL table to a file
Goal: I want to download a table list to a txt or csv file.Initially, as a root user I tried using drushdrush sql-dump --tables-list=media_field_data &gt; db-list.sqlOf course as a root user and Drush set-up not as root. failed with&nbsp;Command 'drush' not found, did you mean: command 'rush'...
Andrew Fletcher12 Apr 2022
Create a MySQL database using command line (CLI)
On your local OSX environment using Terminal or iTerm you can create a MySQL database, database user, and password, as well as, assign all privileges to the user for the database. Knowing your credentials, before beginning you will need to know the following: user: {user} password:...