Let the platform do the work

Resetting the Administrator Password From the Database

Overview

If a Sugar administrator of an on-site instance cannot log in, you can reset the administrator password from the database to regain access. If an administrator can log in, please refer to the Change a User's Password article instead. This article assumes that the Sugar instance is hosted on-site and does not have SugarIdentity enabled.

Resolution

In the root folder of your Sugar installation, open the config.php file and look for the following:

  'dbconfig' =>
   array (
     'db_host_name' => 'your_database_host',
     'db_host_instance' => 'SQLEXPRESS',
     'db_user_name' => 'your_database_user',
     'db_password' => 'your_database_password',
     'db_name' => 'your_database_name',
     'db_type' => 'mysql',
     'db_port' => '',
     'db_manager' => 'MysqliManager',
   ),

Using the above information, you can run the following command line statement from the web server hosting Sugar:

  mysql -h your_database_host -u your_database_user your_database_name -pyour_database_password

Once you are logged into the database, run the following query to identify an active admin account:

  SELECT user_name FROM users WHERE is_admin = '1' AND status = 'Active';

Select a user_name from the list to reset the password and run the following query to reset the password:

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

Once that query is run, you will be able to log into that admin account using the password "Password123". Please ensure that the password is then immediately updated to something secure.