Configuring and Testing the MySQL Database Connections

Configuring the Registration Server’s MySQL configuration

If the username, password or host name to connect to the MySQL database server have been changed from the installation defaults, you need to update the login credentials used by the Registration Server’s Yvva Runtime Environment.

To change the MySQL login credentials for the Registration Server’s database connections, open the file /etc/td-regserver.my.cnf in a text editor.

The user field identifies the user name, while the password field contains the MySQL user’s password in plain text.

::

# # This configuration file defines the MySQL login credentials (e.g. username, # password, host name) used by the TeamDrive Registration Server Apache module # (mod_yvva), the TeamDrive Registration Server Auto Tasks (service # td-regserver) and (optionally) the PHP-based TeamDrive Registration Server # Admin Console. You need to restart httpd and the TeamDrive Registration # Server background process after making changes to this file. #

[regdb] database=td2reg user=teamdrive password=teamdrive host=localhost socket=/var/lib/mysql/mysql.sock

Note

Please note that this file contains the MySQL login credentials in plain text. Make sure to restrict the access permissions to this file so that only the root user and the Apache HTTP Server (mod_yvva in particular) can open this file. The file ownerships should be set to apache:apache, the file permissions should be set to “600”.

After making changes to the credentials, you have to restart the Apache HTTP Server and the td-regserver background service.

If you’re seeing any errors at this stage, please consult the chapter Troubleshooting for guidance. Double check that the MySQL login credentials are correct. Also try to connect to the MySQL database using these values from the mysql command line client.

Administration Console MySQL Configuration

In order to being able to manage the Registration Server, the PHP-based Administration Console needs to be able to connect to the Registration Server’s MySQL Database.

By default, the Administration Console uses the same configuration file as the Registration Server (/etc/td-regserver.my.cnf), so any changes made in this file also apply to the Administration Console, if it’s located on the same host as the actual Registration Server.

The location of the MySQL configuration file is specified in the configuration file /var/www/html/tdlibs/globals.php. The distribution ships with an example configuration file /var/www/html/tdlibs/globals-sample.php — just copy it to globals.php and modify it to match your environment:

<?php
  /*
   * This file specifies how the TeamDrive Registration Server
   * Adminstration Console connects to the MySQL database.
   *
   * Please change these settings to suit your environment, and then
   * save this file as "globals.php"
   */

  /*
   * Specify a path to a local MySQL configuration file (default).
   * If found, these values override any settings provided in $dsn2import
   * below.
   *
   * The file should look as follows (MySQL INI-style format):
   *
   * [regdb]
   * database=td2reg
   * user=teamdrive
   * password=teamdrive
   * host=localhost
   */
   $mysqlConfigFile = '/etc/td-regserver.my.cnf';

  /*
   * Alternatively, enter the connection string to connect the MySQL database.
   * Use this option if the Admin Console is installed on a separate host and
   * there's no TeamDrive specific MySQL configuration file
   *
   * The format is: mysql://<username>:<password>@<host>/<database>
   */
   //$dsn2import = 'mysql://teamdrive:teamdrive@127.0.0.1/td2reg';
?>

As an alternative to providing the location of a MySQL configuration file (e.g. when installing the Administration Console on a different host), you can define the username, password and hostname required to connect to the MySQL database server in globals.php directly, by commenting out the $mysqlConfigFile variable and updating the connection string in the variable $dsn2import accordingly:

$dsn2import = 'mysql://teamdrive:teamdrive@127.0.0.1/td2reg';

The format is mysql://<username>:<password>@<hostname>/databasename. The database name usually does not need to be modified (td2reg is the default name).

The file must be readable by the user that the Apache HTTP Server is running under, usually apache, but should otherwise be protected against unauthorized viewing (e.g. by setting the file ownerships to apache:apache and the access privileges to 600).