Installation Problem - "database error" when adding new team

Discussion forum about Anuko Time Tracker
Post Reply
serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Installation Problem - "database error" when adding new team

Post by serath » Mon Feb 19, 2018 12:43 pm

Hi,

DBinstall.php went pretty ok (apart from the fact that it reported missing <?php), but I am unable to:
- log in as admin (according to installation guide it should be admin/secret after 1st installation)
- I cannot create any team, as it keeps returning 'Database error' with no further info

Version is pulled from Git, I am trying to run it locally on WampServer

wrc
Posts: 269
Joined: Tue May 25, 2010 8:30 pm

Re: Installation Problem - "database error" when adding new

Post by wrc » Mon Feb 19, 2018 1:47 pm

Did you create the database structure? It's the 1st step on top of dbinstall.php.

How many tables does dbinstall.php report? Last 2 strings in the environment check block on top should look like:

Code: Select all

Connection to database successful.
There are 20 tables in database.
Last edited by wrc on Mon Feb 19, 2018 2:30 pm, edited 1 time in total.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Installation Problem - "database error" when adding new

Post by serath » Mon Feb 19, 2018 1:50 pm

Yes, I did the 1st step of the dbinstall to deploy entire structure.
It reports 20 tables:

Code: Select all

Connection to database successful.
There are 20 tables in database.
Also at the stage where the script creates admin user I get:

Code: Select all

INSERT INTO `tt_users` (`login`, `password`, `name`, `team_id`, `role`) VALUES ('admin', md5('secret'), 'Admin', '0', '1024')
error: MDB2 Error: unknown error

wrc
Posts: 269
Joined: Tue May 25, 2010 8:30 pm

Re: Installation Problem - "database error" when adding new

Post by wrc » Mon Feb 19, 2018 2:21 pm

it failed to create an admin account.

I would try to use mysql console and execute the INSERT INTO command in it to see if it gets you a more detailed error description. Assuming your database is called timetracker

Code: Select all

use timetracker;
INSERT INTO tt_users (login, password, name, team_id, role) VALUES ('admin', md5('secret'), 'Admin', 0, 1024);

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Installation Problem - "database error" when adding new

Post by serath » Mon Feb 19, 2018 2:46 pm

Ok, I think I know where the problem is - the query is incorrect:
#1364 - Field 'timestamp' doesn't have a default value.

If I add a timestamp and change the query to: INSERT INTO tt_users (timestamp, login, password, name, team_id, role) VALUES ('2018-02-19 15:45:00', 'admin', md5('secret'), 'Admin', 0, 1024)
it went with a success and I was able to log in.

But still when I try to create a new team I get 'Database error'.

Nik
Posts: 461
Joined: Wed May 26, 2010 5:55 pm

Re: Installation Problem - "database error" when adding new

Post by Nik » Mon Feb 19, 2018 3:58 pm

serath wrote:Ok, I think I know where the problem is - the query is incorrect:
#1364 - Field 'timestamp' doesn't have a default value.
What is your version of MySQL server? It looks like it is picky about timestamps. You can probably fix it by downgrading the server, or changing mysql.sql so that default values for timestamps are provided or the columns are nullable.

Nik
Posts: 461
Joined: Wed May 26, 2010 5:55 pm

Re: Installation Problem - "database error" when adding new

Post by Nik » Mon Feb 19, 2018 6:17 pm

I fixed this in Time Tracker 1.17.24.4002. Drop the tables tt_users and tt_teams and re-create the database structure using updated mysql.sql.

The code change is summarized here.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Installation Problem - "database error" when adding new

Post by serath » Mon Feb 19, 2018 6:27 pm

Thanks Nik - I will check it tomorrow in the morning and I'll give you a feedback whether it flies.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Installation Problem - "database error" when adding new

Post by serath » Tue Feb 20, 2018 7:58 am

Hi Nik - the fix works like a charm, thank you.

If that helps - I am running WampServer 3.1.0: Apache 2.4.27, PHP 5.6.31, MySQL 5.7.19

Post Reply