Forgotten Admin Password fo my moodle website.

Forgotten Admin Password fo my moodle website.

by John Smith -
Number of replies: 25

Latest version of moodle installed on ubuntu server.

How do I retrieve forgotton password?

Average of ratings: -
In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Click the 'lost password' link on the login page?

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

it comes up as error. saying Smttp server is not set up. Is there any other way I could retrieve it and how would I do this please?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

In which case you'll need to access the database. Roughly speaking you want to execure the SQL query...

UPDATE mdl_user SET password=md5('new password') WHERE username='admin';

where 'new password' (in quotes) is the new password you want and 'admin' (in quotes) is the login name of your admin account.

How you do this depends on what access you have to your database. You may well have a nice web manager where you can search for the record and set the new password. To 'encrypt' as md5 you can use a site like http://www.miraclesalad.com/webtools/md5.php .

Once you get back in, change your password through the Moodle user interface (it's more secure assuming you set a salt value). Then get your mail working wink

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Thank you, I am all new to this and is my first time using ubuntu, so what will be the best way to get to my database, How can I access my database?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

How did you create the database in the first place? Almost certainly whatever you used then you will use now. If you are familiar with the command line then it's going to be something like...

$ mysql -u root -p
(Enter your MySQL passsword if you set one)

mysql> use moodle   (or whaver your moodle database is called)
mysql> SELECT..... (from prev

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

I used command but I tried this $ mysql -u root -p but I have now forgotton mysql login details username and password. Does this mean I have to re install moodle again? and if so How do i uninstall it so it is completely removed so I can re install it ?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

mysql has loaded on terminal,

starts like >> mysql  Ver 14.14 Distrib 5...............

where do i go from here in order to retreive my pasword?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you got the mysql prompt then you can put in the commands in my post above (USE... then UPDATE...)

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Hi, I didn't get a prompt it just came up with the version and a long list of things of usage and variables, It doesn't look right to me. after the code  -u root -p

Is this what is meant to come up?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is what I get on by Ubuntu desktop (I don't have a password but it isn't opened up to the network)...


$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1324
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Hi,

Mine does not show anything like the following

( -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1324
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

My code starts like

<code>

mysql  Ver 14.14 Distrib 5...............

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

etc.

the last line of code is

show - warnings   FALSE

is this correct?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

So are you saying you don't get a ' mysql> ' prompt up?

Any change of getting a screen dump of this?

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Hi, this is what I get?

Attachment Screenshot-1.png
In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Erm... that's the help/usage text to tell you how to use the command - you typed it wrongly

> mysql -u root -p

(as above somewhere). Is 'moodleserver' your database or what? I'm not sure what that's doing there - it's wrong anyway

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Ken Task -
Picture of Particularly helpful Moodlers

Have you tried command line?

cd /pathtomoodle/moodle/admin/cli/

php reset_password.php

The above does require that the config.php file at moodle root has db user/password and DB correct.

'spirit of sharing', Ken

In reply to Ken Task

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Hi, if I type the above code in Terminal it should allow me to reset the password?

 

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

yes...

php /path/to/moodle/admin/cli/reset_password.php

...follow the prompts.

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

could not open input files: /path/to/moodle/admin/cli/reset_password.php

This is what I get.

I have also tried to remove moodle bye

 

sudo -s apt-get remove moodle

it come up with, package moodle was not installed so not removed.

 

I have installed moodle on this pc.

In the file system on ubuntu desktop all the files are ther and the moodle folder

 

How do I remove it and start a fresh installation.

 

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

i have got in to mysyl database smile

 

What is the code to retrieve my password?

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Ken Task -
Picture of Particularly helpful Moodlers

John,

Some directions for command line include paths that you have to adjust due to your setup ... which may NOT be similar to those attempting to help you.

First, your moodle directory (that's the code) should be in /var/www-data/ on a Ubuntu machine typically configured.

Do NOT include [ENTER] in the commands below.  Those indicate you press the [ENTER] key. DO type the other text, represented here in 'green'.

cd /var/www-data/ [ENTER]

ls [ENTER]

Do you see a 'moodle' directory?  If so, change into it:

cd moodle [ENTER]

ls [ENTER]

The above list files/folders contained therein.  Do you see any files/folders?  If so, then continue:

cd admin/cli/ [ENTER]

ls [ENTER]

Do you see a file called 'reset_password.php'?  If so, then continue:

php reset_password.php [ENTER]

You will be responding to prompts at the command line and what you type may not echo back to the display.  Take your time ... type slowly and deliberately.  Before you press [ENTER] write down on a sheet of paper what you typed in.

You will be prompted again for the password.  Type it in EXACTLY as you typed it before.  Password is case sensitive.

After the script completes, launch your browser and go to the site and attempt to login.

MIght I suggest finding a tutorial on using the command line on Ubutnu via Google? ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Ubuntu's web root by default is /var/www not var/www-data.  I think you might be getting confused with the Apache user?

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhh ... you are correct.  Had a 'senior moment' there.  /var/www/ is the location of the moodle code directory.  Thanks for correcting.

Hopefully, we'll get John through this first hurdle! ;)

'spirit of sharing', Ken

In reply to John Smith

Re: Forgotten Admin Password fo my moodle website.

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you REALLY typed in the 'path' and the 'to' and the 'moodle' verbatim I'm going to go and cry.... however I see Ken has tried to explain, so I'll leave it there wink

In reply to Howard Miller

Re: Forgotten Admin Password fo my moodle website.

by John Smith -

Thank you both for the help, really appreciate it

Is there any where I could learn the coding for using moodle from. Like the basics?