Configuring and Testing the MySQL Database Connections ====================================================== .. _dbconfigure: 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 PrimeBase Application Environment. To change the MySQL login credentials for the Registration Server's database connections, edit the connection definitions ``TD2REG_WRITE`` and ``TD2REG_SLAVE`` in file ``/usr/local/primebase/setup/connect.def`` |---| the ``\su`` field identifies the user name, while the ``\sp`` field contains the MySQL user's password in plain text. :: td2as:mem:\tCustom DAL\eflibpbvm.so TD2REG_WRITE:mem:\xoHost=127.0.0.1;Charset=utf8;Reconnect=\tCustom DAL\eflibpbvm.so\bOpenServer\nOpenServer\suteamdrive\spteamdrive\dbtd2reg TD2REG_SLAVE:mem:\xoHost=127.0.0.1;Charset=utf8;Reconnect=\tCustom DAL\eflibpbvm.so\bOpenServer\nOpenServer\suteamdrive\spteamdrive\dbtd2reg Please make sure to change these values for **both** connections in the list. Each connection definition (beginning with ``td2as:``, ``TD2REG_WRITE:`` and ``TD2REG_SLAVE:``) must be on a single line (no white space or line breaks). .. 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_pbt`` in particular) can open this file. The file ownerships should be set to ``root:apache``, the file permissions should be set to "640". You should test the connection after updating the MySQL login credentials. Change into the PrimeBase home directory and start the PrimeBase Automation Client application by typing ``pbac``:: [root@regserver ~]# cd $PRIMEBASEHOME [root@regserver primebase]# pbac PrimeBase Automation Client. Copyright 2007-2014, PrimeBase Systems GmbH. Web: http://www.primebase.net E-mail: support@primebase.net Select a connection by number, and Login: Or enter 'A' to add, 'D' to delete, or 'E' to edit an entry. Or enter 'T' to move an entry to the top of the list. File: ./setup/connect.def Alias Protocol Server ------------------------------------------------------------------------ 0 (exit without connecting) 1 td2as Internal/Runtime 2 TD2REG_WRITE Internal/Runtime OpenServer 3 TD2REG_SLAVE Internal/Runtime OpenServer Do this by selecting the connection entry ``2 TD2REG_WRITE`` from the connection list:: Alias Protocol Server ------------------------------------------------------------------------ 0 (exit without connecting) 1 td2as Internal/Runtime 2 TD2REG_WRITE Internal/Runtime OpenServer 3 TD2REG_SLAVE Internal/Runtime OpenServer ------------------------------------------------------------------------ Connection..: 2 User........: teamdrive Password....: ********* 1: Connected to "TD2REG_WRITE" as "teamdrive". For a list of commands enter "#help" 1: 1> quit 1: Closed. After confirming username and password the PBAC console should have started without any error messages. To leave the PBAC console type ``quit`` and press . If you're seeing an error message at this stage, please consult the log file ``/var/log/pbvm.log`` and 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. .. _adminconsoleconfig: 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. To define the username, password and hostname required to connect to the MySQL database server, you need to provide these login credentials in the configuration file ``/var/www/html/tdlibs/globals.php``. Update the connection string in the variable ``$dsn2import`` accordingly:: $dsn2import = 'mysql://teamdrive:teamdrive@127.0.0.1/td2reg'; The format is ``mysql://:@/databasename``. The database name usually does not need to be modified (``td2reg`` is the default name). As an alternative to providing the MySQL login credentials here, you can create a MySQL INI-style configuration file (e.g. ``/etc/td-regserver.my.cnf``):: [regdb] database=td2reg user=teamdrive password=teamdrive host=localhost 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``). Specify the location of this file by uncommenting and entering the full path in the configuration variable ``$mysqlConfigFile`` in ``globals.php``. The values provided in this file take precedence over any login details entered in ``$dsn2import``:: $mysqlConfigFile = '/etc/td-regserver.my.cnf';