New day new challenge :) If you have a site on GoDaddy's shared hosting you get cPanel and phpMyAdmin but no ssh which is sad but that's shared hosting. Resetting the password on Drupal 8 is possible but not easy.
Use the php script on this page that you need to upload to your root of the site. I copied the script here as well.
Create a file name with hard to guess name like "mypassword.php" :)
-
<?php
-
use Drupal\Core\DrupalKernel;
-
use Symfony\Component\HttpFoundation\Request;
-
-
if (pathinfo(__FILE__, PATHINFO_FILENAME) == 'admin-pass-reset') {
-
die('Please change your file name to a random string to continue');
-
}
-
-
// Boot Drupal.
-
$autoloader = require __DIR__ . '/autoload.php';
-
-
$request = Request::createFromGlobals();
-
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', FALSE);
-
$kernel->boot();
-
-
// Get password hasher service.
-
$password_hasher = $kernel->getContainer()->get('password');
-
-
// Hash password.
-
if (isset($_GET['pass']) && !empty($_GET['pass'])) {
-
$newhash = $password_hasher->hash($_GET['pass']);
-
}
-
else {
-
die('Retry with ?pass=PASSWORD set in the URL');
-
}
-
-
// Update user password.
-
$updatepass = Drupal::database()->update('users_field_data')
-
->fields(array(
-
'pass' => $newhash,
-
// 'name' => 'admin',
-
// 'mail' => '<a href="mailto:yourmail@example.com">yourmail@example.com</a>'
-
))
-
->condition('uid', '1', '=')
-
->execute();
-
-
// Clean user 1 cache.
-
Drupal::cache('entity')->delete('values:user:1');
-
-
print "Done. Please delete this file as soon as possible";
Then go to this url to reset the password.
www.example.com/mypassword.php?pass=newpassword
This will set the password of user 1 to "newpassword" or whatever argument you pass. Don't forget to delete the file as well from the server.
Enjoy and use it at your own risk.