In some situations, this may not be possible. For example, your site may have been "hacked" and had the passwords or users changed. Or perhaps the person who knew the passwords is no longer available. Or maybe you have forgotten the password that was used.
In these cases, it is still possible to alter the Joomla! database so you can log back in as a Super Administrator. These are the possible methods available to Joomla! administrators.
Method 1: Editing configuration.php file
Method 2: Direct Editing of Database
More details here.