您的位置:首页 > 其它

Drupal 登录提示Unrecognized Username and Password. 【已解决】

2016-05-19 03:34 447 查看
使用 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!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: