MySQL is the default Jabberd 2 package for storage and authentication.
Complete this section if you are using MySQL for storage and/or authorization. In order to set up MySQL for Jabberd, you must run the setup script included in the Jabberd 2 distribution. After the script is run, you should create a user and then grant that user access to the database.
First, run the MySQL setup script. This script is located in '[Jabberd Source Files]/tools'. Switch to the tools directory and start the MySQL console (the MySQL server should already be running). Then, run the db-setup.mysql script from the MySQL console:
mysql -u root -p
mysql>\. db-setup.mysql
Now that a database for Jabberd exists in the MySQL data directory, create a MySQL user that Jabberd can use to connect to the MySQL server.
secret with the password you have chosen for your Jabberd MySQL user:
GRANT select,insert,delete,update ON jabberd2.*
to jabberd2@localhost IDENTIFIED by 'secret';
Note that the password secret is the default password used in the Jabberd configuration files for MySQL.
MySQL is now ready to be used with Jabberd.
/tmp/mysql.sock. The default socket when installing MySQL from source is /var/lib/mysql/mysql.sock. You will need to create a symlink to /tmp/mysql.sock if it does not exist:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
If you are unsure as to where your MySQL server socket is, consult your MySQL configuration file (usually located in /etc/my.cnf or /etc/mysql/my.cnf).
sm.xml)
Complete this section if you are using MySQL for storage. Most installations using MySQL for storage will require only the setting of the driver, user and password.
In sm.xml under the section labeled Storage database configuration, make sure that the driver is to use mysql. (The driver should be set to mysql by default.):
<!-- Storage database configuration -->
<storage>
<!-- By default, we use the MySQL driver for all storage -->
<driver>mysql</driver>
sm.xml under the section labeled MySQL driver configuration, replace secret with your MySQL password. Change the user if you are not using the default user (jabberd2):
<!-- MySQL driver configuration -->
<mysql>
<!-- Database server host and port -->
<host>localhost</host>
<port>3306</port>
<!-- Database name -->
<dbname>jabberd2</dbname>
<!-- Database username and password -->
<user>jabberd2</user>
<pass>secret</pass>
<!-- Transaction support. If this is commented out, transactions
will be disabled. This might make database accesses faster,
but data may be lost if jabberd crashes.
This will need to be disabled if you are using a MySQL
earlier than v3.23.xx, as transaction support did not appear
until this version. -->
<transactions/>
</mysql>
Note that you should change the host setting only if your MySQL server is running on a different host. You should change the port setting only if your MySQL server is running on a non-standard port (port 3306 is the default for MySQL installations). The transaction support section is self-explanatory.
Jabberd 2 is now configured to use MySQL for storage.
If you wish to use an authentication package other than MySQL, jump to your selection of authentication package:
Otherwise, continue on to 4.4.3. directly below to finish your Jabberd 2 configuration.
c2s.xml)
Complete this section if you are using MySQL for authentication. Jabberd 2 authentication configuration for MySQL is the same as above, except that the information is contained in c2s.xml.
c2s.xml under the section labeled Authentication/registration database configuration, make sure that the driver is to use mysql. (The driver should be set to mysql by default.):
<!-- Authentication/registration database configuration -->
<authreg>
<!-- Backend module to use -->
<module>mysql</module>
c2s.xml under the section labeled MySQL module configuration, replace secret with your MySQL password. Change the user if you are not using the default user (jabberd2):
<!-- MySQL module configuration -->
<mysql>
<!-- Database server host and port -->
<host>localhost</host>
<port>3306</port>
<!-- Database name -->
<dbname>jabberd2</dbname>
<!-- Database username and password -->
<user>jabberd2</user>
<pass>secret</pass>
</mysql>
Note that you should change the host setting only if your MySQL server is running on a different host. You should change the port setting only if your MySQL server is running on a non-standard port (port 3306 is the default for MySQL installations).
Your Jabberd 2 configuration for storage and authentication is now complete. Jump to Test Server to begin testing your server before moving on other configuration tasks, such as configuring SSL, in Section 5.
© 2003 Will Kamishlian and Robert Norris
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
