Sunday, December 26, 2010

reset admin password for moodle


I installed Moodle in my Windows 7. When I logout, I forgot my admin password.
Below is how to reset admin password.
1) click start menu, go to All Program, click MySQL, Click MySQL Server 5.1
click MySQL command line client
2) enter your mysql password.
3) type following:
show databases;
use moodle;
show tables;
select username, password from mdl_user;
4) Here password is  md5 encrypted (varchar(32)), you can set a password and use following php script to get md5 password:
<?
$password = "mypass";
$password = md5($password );
echo $password;
?>
for example you get: a029d0df84eb5549c641e04a9ef389e5
5) update mdl_user set password='a029d0df84eb5549c641e04a9ef389e5' where username='admin';
6) commit;
7) Now you can use username: admin and password: mypass
to login your moodle.

No comments:

Post a Comment