How to Create a Database for Time Tracker
This page describes how to create and populate a MySQL database for Time Tracker
. See Installation Guide
for detailed instructions.
This procedure involves several steps:
- Creating db in MySQL console.
- Granting access permissions to a specific user.
- Populating the database (creating tables, indexes, etc.)
Login to MySQL console.
$ mysql -h localhost -u root -p
Then, in MySQL console, use the create database
mysql> CREATE DATABASE timetracker CHARACTER SET = 'utf8';
At this point the database named timetracker
is created without access permissions. You can see whether it exists by issuing the show databases
command. It must be in the list that follows.
mysql> show databases;
| Database |
| information_schema |
| mysql |
| performance_schema |
| timetracker |
4 rows in set (0.00 sec)
To exit MySQL console type exit;
In order for Time Tracker script to have access to the database you need to grant access permissions. In MySQL console we can use something like this:
mysql> GRANT ALL ON timetracker.* TO 'ttuser'@'localhost' IDENTIFIED BY 'ttpassword';
In the example above, we have granted all privileges to timetracker
db to a MySQL user account ttuser
whose password is ttpassword
The second step is to define the same values for DSN
in Time Tracker config.php file. For example:
By this point we have an empty database with an account that is allowed to use it.
To populate timetracker database, use your browser and go to dbinstall.php script in the root of your installation directory.
Use dbinstall.php to create Time Tracker database structure
After clicking the Create
button, the database should be populated. Internally, it executes mysql.sql
script from Time Tracker distribution. By this point Time Tracker should be ready for use.
Do not forget to remove dbinstall.php after successful install.
Time Tracker FAQ