<h3class="sectionedit3"id="prepare_the_database">Prepare the database</h3>
<divclass="level3">
<p>
Your database must have a specific table to host sessions. Here are some examples for main databases servers.
</p>
<divclass="noteimportant">If your database doesn't accept UTF-8 characters in 'text' field, use 'blob' instead of 'text'.
id <spanclass="kw1">CHAR</span><spanclass="br0">(</span><spanclass="nu0">32</span><spanclass="br0">)</span><spanclass="kw1">NOT</span><spanclass="kw1">NULL</span><spanclass="kw1">PRIMARY</span><spanclass="kw1">KEY</span><spanclass="sy0">,</span>
<divclass="noteimportant">Change char(32) by char(64) if you use the now recommended SHA256 hash algorithm. See <ahref="documentation/latest/sessions.html"class="wikilink1"title="documentation:latest:sessions">Sessions</a> for more details
</div><divclass="notetip">You can change table name <code>sessions</code> to whatever you want, just adapt the parameter <code>TableName</code> in module options.
</div>
</div>
<h4id="postgresql">PostgreSQL</h4>
<divclass="level4">
<p>
Create user and role:
</p>
<preclass="code">su - postgres
createuser lemonldap-ng -P</pre>
<preclass="code">Entrez le mot de passe pour le nouveau rôle : <PASSWORD>
Entrez-le de nouveau : <PASSWORD>
Le nouveau rôle est-il un super-utilisateur ? (o/n) n
Le nouveau rôle doit-il être autorisé à créer des bases de données ? (o/n) n
Le nouveau rôle doit-il être autorisé à créer de nouveaux rôles ? (o/n) n</pre>
<divclass="noteimportant">Change char(32) by char(64) if you use the now recommended SHA256 hash algorithm. See <ahref="documentation/latest/sessions.html"class="wikilink1"title="documentation:latest:sessions">Sessions</a> for more details
<!-- EDIT3 SECTION "Prepare the database" [488-2206] -->
<h3class="sectionedit4"id="manager">Manager</h3>
<divclass="level3">
<p>
Go in the Manager and set the session module (for example <ahref="http://search.cpan.org/perldoc?Apache::Session::Postgres"class="urlextern"title="http://search.cpan.org/perldoc?Apache::Session::Postgres"rel="nofollow">Apache::Session::Postgres</a> for PostgreSQL) in <code>General parameters</code> » <code>Sessions</code> » <code>Session storage</code> » <code>Apache::Session module</code> and add the following parameters (case sensitive):
<thclass="col0 centeralign"> Name </th><thclass="col1 centeralign"> Comment </th><thclass="col2 centeralign"> Example </th>
</tr>
</thead>
<trclass="row2 roweven">
<tdclass="col0 centeralign"><strong>DataSource</strong></td><tdclass="col1"> The <ahref="http://search.cpan.org/perldoc?DBI"class="urlextern"title="http://search.cpan.org/perldoc?DBI"rel="nofollow">DBI</a> string </td><tdclass="col2"> dbi:Pg:dbname=sessions;host=10.2.3.1 </td>
</tr>
<trclass="row3 rowodd">
<tdclass="col0 centeralign"><strong>UserName</strong></td><tdclass="col1"> The database username </td><tdclass="col2"> lemonldapng </td>
</tr>
<trclass="row4 roweven">
<tdclass="col0 centeralign"><strong>Password</strong></td><tdclass="col1"> The database password </td><tdclass="col2"> mysuperpassword </td>
</tr>
<trclass="row5 rowodd">
<tdclass="col0 centeralign"><strong>Commit</strong></td><tdclass="col1"> Required for PostgreSQL </td><tdclass="col2"> 1 </td>
</tr>
<trclass="row6 roweven">
<tdclass="col0 centeralign"><strong>TableName</strong></td><tdclass="col1"> Name of the table </td><tdclass="col2"> sessions </td>
</tr>
</table></div>
<!-- EDIT5 TABLE [2535-2929] -->
<p>
You must read the man page corresponding to your database (<ahref="http://search.cpan.org/perldoc?Apache::Session::MySQL"class="urlextern"title="http://search.cpan.org/perldoc?Apache::Session::MySQL"rel="nofollow">Apache::Session::MySQL</a>, …) to learn more about parameters. You must also install the database connector (<ahref="http://search.cpan.org/perldoc?DBD::Oracle"class="urlextern"title="http://search.cpan.org/perldoc?DBD::Oracle"rel="nofollow">DBD::Oracle</a>, <ahref="http://search.cpan.org/perldoc?DBD::Pg"class="urlextern"title="http://search.cpan.org/perldoc?DBD::Pg"rel="nofollow">DBD::Pg</a>,…)
</p>
<divclass="notetip">For MySQL, you need to set additional parameters:<ul>
If you choose to use MySQL, read <ahref="performances.html#apachesession_performances"class="wikilink1"title="documentation:2.0:performances">how to increase MySQL performances</a>.
You can also use different user/password for your servers by overriding parameters <code>globalStorage</code> and <code>globalStorageOptions</code> in lemonldap-ng.ini file.