Drupal 登入提示Unrecognized Username and Password. 【已解決】
阿新 • • 發佈:2019-02-01
使用 Drupal 進行建站,使用admin登入,在logout 之後再想登入就會出現 Unrecognized Username and Password. 但是查詢資料庫的users表發現,admin賬號還在所以可以確定admin的密碼可能出現了問題。 因為密碼使用hash進行了加密,所以我們不能直接對資料庫中的密碼列進行修改,但是我發現了另外一種解決辦法。方法如下。
1. 找到 drupal的根路徑,在根路徑下會有一個index.php
2. 開啟並修改該 index.php. 修改內容如下;儲存。
<?php /** * @file * The PHP page that serves all page requests on a Drupal installation. * * The routines here dispatch control to the appropriate handler, which then * prints the appropriate page. * * All Drupal code is released under the GNU General Public License. * See COPYRIGHT.txt and LICENSE.txt. */ /** * Root directory of Drupal installation. */ define('DRUPAL_ROOT', getcwd()); require_once 'includes/password.inc'; echo user_hash_password('yournewpassword'); die(); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler();
3. 在遊覽器中開啟該index.php.
在遊覽器中開啟該php檔案時你會發現一個只顯示一行亂碼的網頁,這行亂碼就是你的新密碼加密過之後的結果。
4. 複製這行亂碼,開啟資料庫,替換掉你想要更新密碼的賬戶的密碼。
5. Done!