SugarCRM SupportHelp ArticlesUser Login ManagementResetting the Administrator Password From the Database

Resetting the Administrator Password From the Database

Overview

In the event that a Sugar administrator cannot log in, you can reset the administrator password from the database in order to regain access to any administrative functions in the application. If an administrator can log in, please refer to the Change a User's Password article instead.

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.

ChrisR

Last modified: 2020-01-24 14:53:00