Database Creation failed

Database Creation failed

by Steve Dalton -
Number of replies: 6
Hi All

Just discovered Moodle after reading the recent Linux Journal article. Looks interesting so thought I'd give it a try.

Just tried my first install - have installed via CVS from 1.4 Stable branch. Everything going well - until I got to the database creation part... everything created successfully apart from one:

(mysql): CREATE TABLE `mdl_user_teachers` ( `id` int(10) unsigned NOT NULL auto_increment, `userid` int(10) unsigned NOT NULL default '0', `course` int(10) unsigned NOT NULL default '0', `authority` int(10) NOT NULL default '3', `role` varchar(40) NOT NULL default '', `editall` int(1) unsigned NOT NULL default '1', `timestart` int(10) unsigned NOT NULL default '0', `timeend` int(10) unsigned NOT NULL default '0', `timemodified` int(10) unsigned NOT NULL default '0', `timeaccess` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), KEY UNIQUE `courseuserid` (course, userid), KEY `userid` (userid)) TYPE=MyISAM COMMENT='One record per teacher per course'

1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE `courseuserid` (course,userid), KEY `userid` (userid))

adodb_mysql._execute(CREATE TABLE `mdl_user_teachers` ( `id` int(10) unsigned NOT NU..., false) % line 804, file: adodb.inc.php

adodb_mysql.execute(CREATE TABLE `mdl_user_teachers` ( `id` int(10) unsigned NOT NU...) % line 30, file: datalib.php

execute_sql() % line 152, file: datalib.php

modify_database(CREATE TABLE `mdl_user_teachers` ( `id` int(10) unsigned NOT NU...) % line 111, file: index.php

Error

Any help much appreciated!

Steve
Average of ratings: -
In reply to Steve Dalton

Re: Database Creation failed

by Paul Perger -

Hi!

I had the same problem, I think the error is that

KEY UNIQUE `courseuserid`

should be

UNIQUE KEY `courseuserid`.

If you know how to use sql (for example in phpmyadmin) you can copy the whole thing from "CREATE TABLE ..." to "...'One record per teacher per course'" into your sql-interface, correct the thing mentioned above and create the missing table this way. At least it worked with my installation although I consider this a bug in the latest version.

Paul


In reply to Paul Perger

Re: Database Creation failed

by Penny Leach -
Hi,

This is now fixed in CVS so try cvs update if you're using CVS, and if not, I'm not sure what time the nightlies are built... but the fix will be in the next one.

Cheers
Penny
In reply to Penny Leach

Re: Database Creation failed

by thierry reygnier -
hello

I had the same problem in trying to make a new moodle test site. I prepare a training day to show at several admin how to use and install moodle easily... (from downloading the archive to the final screen of a well install..).

Hopping that the next archive would be ok...

Thanks so much for your job... and excuse my poor english...


In reply to thierry reygnier

Re: Database Creation failed

by Martín Langhoff -
You can always use 1.4.2 instead if 1.4.2+.
In reply to Martín Langhoff

Re: Database Creation failed

by Jan Joost de Vries -
What php file contains this statement? I have dropped all tables and want to use the fixed script and re run the installation.

Joost
In reply to Jan Joost de Vries

Re: Database Creation failed

by Penny Leach -
it's in $CFG->dirroot/lib/db/mysql.sql

NOT

$CFG->dirroot/lib/db/mysql.php

but if you upgrade to the latest nightly, or do cvs update if you're using cvs, it'll have the latest version.