[[connectingTigaseToMysql]]
= Connecting the Tigase Server to MySQL Database
:author: Artur Hefczyc <artur.hefczyc@tigase.net>
:version: v2.1, June 2017: Reformatted for v8.0.0.

Please before continuing reading of this manual have a look at the xref:prepareMysql[initial MySQL database setup]. It will help you with database preparation for connecting with Tigase server.

This guide describes MySQL database connection parameters.

This guide is actually very short as there are example configuration files which can be used and customized for your environment.

[source,dsl]
-----
dataSource {
    default () {
        uri = 'jdbc:mysql://localhost/tigasedb?user=tigase_user&password=mypass'
    }
}
userRepository {
    default () {}
}
authRepository {
    default () {}
}
-----

This is the basic setup for setting up an SQL repository for Tigase. dataSource contains the uri for `default` which is the mysql database.
MySQL connector requires connection string in the following format:
`jdbc:mysql://[hostname]/[database name]?user=[user name]&password=[user password]`

Edit the `config.tdsl` file for your environment.

Start the server using following command:

[source,sh]
-----
./scripts/tigase.sh start etc/tigase.conf
-----
