2011-06-02 90 views
0

我必須重新設置自己的密碼通過數據庫,我使用的查詢Drupal的密碼設置

UPDATE用戶組通過= MD5(「NEWPASSWORD」)指示WHERE name =「管理員」

但我仍然感到不能夠登錄。

你能告訴我我要去哪裏嗎?

回答

2

使用drupal 7,密碼不再通過md5加密。

有幾種方法可以在drupal7中重置密碼。

使用drush

drush upwd admin --password="newpassword" 

沒有drush,如果你有一個CLI訪問服務器:

cd <drupal root directory> 
php scripts/password-hash.sh 'myPassword' 

現在複製結果哈希並將其粘貼到查詢:

update users set name='admin', pass='pasted_big_hash_from_above' where uid=1; 

如果您在遠程環境上,您無法連接工作,你可以把這個指定的代碼在一個文件中,如password.php這如一個:

<?php 
if (isset($_GET['p'])) { 
    require_once dirname(__FILE__) . '/includes/bootstrap.inc'; 
    require_once dirname(__FILE__) . '/includes/password.inc'; 
    print _password_crypt('sha512', $_GET['p'], _password_generate_salt(DRUPAL_HASH_COUNT)); 
    exit(); 
} 
print "No password to hash."; 

,然後用打你的網站: http://domain.tld/password.php?p=MyPassword。哈希將出現在您的瀏覽器選項卡上。
一旦完成,不要忘記將其刪除。

+0

謝謝..我已經嘗試過第二個選項,它得到工作..請移除MyPassword周圍的''(引號)..在http://domain.tld/password.php?p ='MyPassword'..因爲密碼用這些引號保存 – PHP 2011-06-05 14:26:45

0

您是否被鎖定在您的帳戶之外?如果您有數據庫訪問權限,請嘗試清除「氾濫」表。