I am trying to help a colleague rebuild a site. We have some backups from 6/29/09, both the moodledata and the MySQL data that are from a different URL. (The online site was deleted by the host during a "transfer of power" gap.)
So here are the steps I followed:
- Installed a blank Moodle instance
- Dropped all the tables, then imported the MySQL backup file
- Uploaded and decompressed the moodledata file over the blank one
I tried the "reset password" script, which reports that "admin" is not a valid account. Neither is "administrator."
I also tried (like a monkey who doesn't know coding):
<?php
require 'config.php';
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$adminroleid = create_role('new admin6', 'admin6', 'delete me later', 'moodle/legacy:admin');
reset_role_capabilities($adminroleid);
$user = get_record('user', 'username', 'admin');
role_assign($adminroleid, $user->id, 0, $systemcontext->id);
echo 'done';
?>
But I think that doesn't work if there is no "admin" account in the first place.
I can't create a new account to elevate to admin, since I get reCAPTCHA Input Error: Invalid Referrer (which I think I know how to fix....once I have an admin account!!!!)
Is there a way to create an admin account manually in the database using MySQLAdmin? Or even to figure out the username of an account that has admin access, in order to reset its password? (I don't know where the usernames are actually stored.) Or turn off reCAPTCHA in the database or where ever so that I can create a new account to elevate?
If you could make it simple enough for a monkey to follow, I would appreciate it. Computers I know, but relational databases make my head hurt.
Ook, ook!
Thanks in advance!!!