Forgotten admin password

Hi Unfortunately I have lost my admin password for SuiteCRM is there anyway to reset it?

If you have access to the DB you can modify and run this query:

UPDATE users SET user_hash = '$2y$10$ua6PicOvqyYMKgOR6gzFcub.Z5s40j6moWRH4oaO.Ef667lz.nb0m'
WHERE user_name = 'YourUserNameHere';

After that try to login with password:
Password123

Thanks,

AlxGr

3 Likes

Hi AlxGR

The DB is is a common area of the server and I can only get at it directly by backing it up and downloading it. I can’t seem to run server command line scripts. If I could find the location of the string in the data base I could change it manually or I need to write a php or something like that. Many thanks for your help.

Regards

Tony

In the root folder of SuiteCRM there is a file called config.php

If you look at this file yo will find the necessary information to connect to the database.

Then write a php script to execute the query provided by @AlxGr and you are done.

First look for a similar section in config.php:


 'dbconfig' => 
  array (
    'db_host_name' => 'yourdbhost',
    'db_user_name' => 'yourdbuser',
    'db_password' => 'yourdbpwd',
    'db_name' => 'yourdbname',
    'db_type' => 'mysql',
  ),

You can try this:


<?php
$dbhost = "yourdbhost"; // replace yourdbhost with the value found in config.php
$dbuser = "yourdbuser"; // replace yourdbuserwith the value found in config.php
$dbpwd ="yourdbpwd"; // replace yourdbpwdwith the value found in config.php
$dbname = "yourdbname"; // replace yourdbnamewith the value found in config.php

    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbname);
    $result = $mysqli->query("UPDATE users SET user_hash = '$2y$10$ua6PicOvqyYMKgOR6gzFcub.Z5s40j6moWRH4oaO.Ef667lz.nb0m' WHERE user_name = 'YourUserNameHere';"); // you must edit also YourUserNameHere and put your actual username (like admin, for example)
?>
1 Like

Hi amariussi

Thank you for this I have written some PHP files but I am not sure how do this so I would be very grateful for some help.

Thank you

I have just edited my previous post with the script.

you just have to:
. find the values in config.php
. then create a script pasting my solution
. save the file calling it reset_pwd.php (once done delete this file!)
. execute it with your browser: http://yourserveraddress/yoursuitecrmfolder/reset_pwd.php

1 Like

Hi Thanks so much for this, I tried it and it did not work, I set the user name to admin. It maybe a path thing to the data base.

Thank you for your excellent help

Tony

If you look at the apache/php log you will see what is causing the script to fail

Or else you may post the script you created. (change username, pwd and host to dummy values)

…Or you can just ask your IT to run the query for you. I guess your company has somebody in charge of it…

Thank you very much for your help. I recently discovered that our ISP does not allow us to run scripts but provides a data base editor. This was really good and I was able to replace the password with the one you gave me. So we are all back up and running thank you very much for your help.

Tony

Thank you, it helped me

If you prefer visual edit than SQL commands then in PHPMYSQL or other mysql manager GUI: list the USERS table data and edit the line for the particular username’s password you forgot ((or pick/edit one) and set the user_hash column to something that you know for instance the example below:

$2y$10$ua6PicOvqyYMKgOR6gzFcub.Z5s40j6moWRH4oaO.Ef667lz.nb0m

This corresponds to password: Password123

IMPORTANT: leave the dropdown (for column data type selection) BLANK: Not MD5 or SHA1 or anything - has to be empty as it originally is usually.

save and you’re set ;D

2 Likes

Does this work for v 8.2.2 as well? (I just installed v8.2 from scratch - and on the login screen for the first time - put in what I thought was my admin username / password that i had JUST typed… and get a Login credentials incorrect, please try again. ugh…!

I then used the trick above - and looking at the users table - it appears correct - but i still get login incorrect.

2 Likes