MySQL Installation and Configuration ==================================== Installing MySQL Server ----------------------- The TeamDrive Hosting Service requires a MySQL database to store its information. This document assumes that the MySQL instance runs on the same host as the Host Server itself, connecting to it via the local socket file. Alternatively, it's possible to use an external MySQL Server. In this case, you need to make sure that this external MySQL instance is reachable via TCP from the Host Server (usually via TCP port 3306) and that the ``teamdrive`` MySQL user account is defined correctly (e.g. the MySQL username in the remote database would become ``teamdrive@hostserver.yourdomain.com`` instead of ``teamdrive@localhost``). Most MySQL installations usually do not allow the ``root`` user to log in from a remote host. In this case the installation script is unable to create the dedicated ``teamdrive`` user automatically and you need to perform this step manually before performing the installation of the TeamDrive Hosting Service databases. Especially the correct definition of the host part is critical, as MySQL considers ``username@hostserver`` and ``username@hostserver.yourdomain.com`` as two different user accounts. To set up the Host Server using a local MySQL Database, install the MySQL Client and Server packages:: [root@hostserver ~]# yum install mysql mysql-server For reliablility and performance reasons, we recommend placing the MySQL data directory ``/var/lib/mysql`` on a dedicated file system or storage volume. Please start the MySQL server, run the secure installation script and follow the recommendations. Make sure to create a password for the MySQL ``root`` user and take note of it:: [root@hostserver ~ ]# service mysqld start Initializing MySQL database: Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h hostinstalltest.local password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] Starting mysqld: [ OK ] [root@hostserver ~ ]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! MySQL is now up and running and you can proceed with creating the ``teamdrive`` user and the MySQL databases required for the TeamDrive Host Server. Creating TeamDrive MySQL User and Databases ------------------------------------------- The TeamDrive Hosting Service requires two MySQL databases ``hostapilog`` and ``pspace``, which will be accessed using a dedicated ``teamdrive`` MySQL user. The Host Server installation package ships with a script that performs the required configuration steps: - Modify the local configuration file ``/etc/my.cnf``, start and enable MySQL Server (only when using a local MySQL Server) - Create the required MySQL user ``teamdrive``, assign the provided password and the required database privileges (requires access to the MySQL ``root`` account) - Create and populate the required Hosting Service MySQL databases - Modify the local Host Server configuration file ``/etc/td-hostserver.my.cnf`` The following example assumes that the MySQL database is located on the same system where the TeamDrive Host Server instance is installed. You need to have the following information available: - The password of the MySQL ``root`` user account - The password that you want to assign to the ``teamdrive`` user The script is part of the ``td-hostserver`` package and is installed in ``/opt/teamdrive/hostserver/mysql/mysql_install.sh``. Call it as the ``root`` user and follow the instructions:: [root@hostserver ~]# /opt/teamdrive/hostserver/mysql/mysql_install.sh TeamDrive Hosting Service MySQL Database Install Script ------------------------------------------------------- Configuring MySQL database for TeamDrive Hosting Service version 3.0.013.0 This script will perform the following steps: - Modify the local configuration file /etc/my.cnf, start and enable MySQL Server (only when MySQL Server runs locally) - Create the required MySQL user "teamdrive", assign the provided password and the required database privileges (requires access to the MySQL root account) - Create and populate the required Hosting Service MySQL databases - Modify the local Host Server configuration file /etc/td-hostserver.my.cnf Enter MySQL hostname: localhost Enter MySQL root password for localhost: Enter MySQL password to be set for user teamdrive: mysqld (pid 7490) is running... Stopping mysqld: [ OK ] Changing local MySQL Server configuration... Backing up existing configuration file /etc/my.cnf... `/etc/my.cnf' -> `/etc/my.cnf-2014-06-12-17:19.bak' Starting and enabling MySQL Server... Starting mysqld: [ OK ] Trying to connect to the MySQL server as root... +---------------+ | MySQL Version | +---------------+ | 5.1.73 | +---------------+ Creating teamdrive MySQL user on localhost Trying to connect to the MySQL server as the teamdrive user... Creating Hosting Service databases... Updating /etc/td-hostserver.my.cnf... Backing up existing configuration file ... `/etc/td-hostserver.my.cnf' -> `/etc/td-hostserver.my.cnf-2014-06-12-17:19.bak' Finished! The MySQL configuration for TeamDrive Hosting Service version 3.0.013.0 is now complete. The MySQL database is now properly configured and populated. As a final test, try logging into the MySQL database from the Host Server system, using the ``teamdrive`` user account and the password you defined |---| you should be able to see and access the TeamDrive Hosting Service databases:: [root@hostserver ~]# mysql -u teamdrive -p Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 51 Server version: 5.1.71 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | hostapilog | | pspace | +--------------------+ 3 rows in set (0.00 sec) mysql> QUIT Bye