Forums | Mahara Community
Mahara 1.1.0 Released
26 February 2009, 13:03
I've had the same problem, see
Using MySQL 5.0.24a
26 February 2009, 16:58
It looks like you might not have a 'root' user with id=0 in your database (we're using that user to own system-wide things like the default profile view).
Could you post the output of something like this:
SELECT id, username FROM mah_usr WHERE id < 5 OR username = 'root';
If you can remember, could you also let me know what version of Mahara you used for your original install (or the approximate date). Nigel reckons there was a time when the root user was being created on MySQL with id = 1 instead of 0, and if your database still has that problem it means we will need to change the id in the upgrade.
26 February 2009, 17:45Hi - one other thing, you're using an unsupported version of MySQL. Mahara doesn't quite run properly on versions before 5.0.25. I don't think it's related to your problem, but you might want to consider upgrading at some point (and you'll have to if you try and install a new 1.1 from scratch).
27 February 2009, 22:23
I guess it's a problem with foreigh keys dependence. It looks like the table can't be altered because his value is bound to another one into another table so that this first should be altered.
Actually i didn't look the details but an easy workaround could be to
SET FOREIGN_KEY_CHECKS = 0;
lauch the upgrade to 1.1.0
SET FOREIGN_KEY_CHECKS = 1;
I didn't test this so it may be wrong, but I guess it can help.
28 February 2009, 3:30Hi - if you need to do that, it's a bug in the upgrade process. If you can nail it down, let us know what the problem is so we can fix it
05 March 2009, 18:49
Thanks for all the comments and suggestions. Just upgraded to MySQL 5.1.32, and tried running the Mahara 1.1.1 upgrade on a fresh copy of the old 1.0.9 database, but still get this:
Failed to get a recordset: mysql error: [1452: Cannot add or update a
child row: a foreign key constraint fails ("mahara111"."mah_view",
CONSTRAINT "mah_view_own_fk" FOREIGN KEY ("owner") REFERENCES "mah_usr"
("id"))] in adodb_throw(INSERT INTO "mah_view" ("title", "description",
"owner", "ownerformat", "ctime", "mtime", "atime", "numcolumns",
"template", "type") VALUES ('Profile view', '', 0, 4, '2009-03-05
16:44:23', '2009-03-05 16:44:23', '2009-03-05 16:44:23', 2, 1,
Command was: INSERT INTO "mah_view" ("title", "description", "owner",
"ownerformat", "ctime", "mtime", "atime", "numcolumns", "template",
"type") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and values was (Profile
view,,0,4,2009-03-05 16:44:23,2009-03-05 16:44:23,2009-03-05
Call stack (most recent first):
- insert_record("view", object(stdClass), "id", true) at /Library/WebServer/Documents/mahara111/lib/db/upgrade.php:575
- xmldb_core_upgrade("2008040218") at /Library/WebServer/Documents/mahara111/lib/upgrade.php:271
- upgrade_core(object(stdClass)) at /Library/WebServer/Documents/mahara111/admin/upgrade.json.php:71
05 March 2009, 20:00
The upgrade inserts a new view which is owned by a user with id=0, and the most likely reason that you are getting that foreign key error is that your database doesn't have a user with id=0. I'd really like to find out if that's true, and if so, how it happened. Could you check the 'mah_usr' table from your old 1.0.9 database (by running the query from my previous post)? That would help us to make a fix for any other people who might have the same problem.
But if you think it's something peculiar with your database, then you could just insert a system user into your 1.0.9 database and try again:
Restore your 1.0.9 db, run this sql command:
INSERT INTO mah_usr (id, password, salt, firstname, lastname, email, quota, username, authinstance) VALUES (0, '*', '*', 'System', 'User', '[email protected]', 10485760, 'root', 1);
And then try the upgrade again.
06 March 2009, 11:18Sorry, I forgot to mention, I did check that out from your previous post. When I first checked, root originally had an id of 463, but I changed it to 0 about a week ago, and since then root has an id of 0 in the working 1.0.9 database, and in all the clones in which I've been testing the upgrade.
08 March 2009, 18:06So if you restore the 1.0.9 db, set root's id to 0, and then do the upgrade from there, are you still getting exactly the same foreign key error that you posted above?
09 March 2009, 5:27Guys, can this thread be split off into another forum instead of "Mahara News"? IMO News is not a good place to discuss installation/upgrade problems. Think of subscribers, rss feeds etc. Thanks.