"I have tried this approach in the config.php but generated database error"
What was the error? And show me the line you added to config.php.
One other way ... again not in phpmyadmin ... but via ssh.
cd /path/to/moodlecode/admin/cli/
Issue:
[root@server cli]# php reset_password.php
== Password reset ==
Enter username (manual authentication only)
Admin account ... your account should have been a manual account.
By entering a username at the prompt above, if found, you will get a prompt for the password. It has to follow the password policy for the site.
Dunno that? Ok, then at same location, use the cfg.php script like so:
php cfg.php |grep password
you should see the following among a couple of others:
minpasswordlength 8
minpassworddigits 1
minpasswordlower 1
minpasswordupper 1
minpasswordnonalphanum 1
Password you set in clear text where you can see it as you type:
Your site may/may not have same requirements, but if it does above means:
8 characters long ... must have one digit ... one lowercase letter .. one upper case letter and one non alpha neumeric character like '!'.
Changing via PHPMyAdmin ... what you see in the password column is md5 hashed with an unkown hash. Good luck there!
'SoS', Ken