21

在我的本地机器上安装 magento 后,我忘记了我给的管理员密码。我无法登录到我的管理区域如何重置密码

我已经阅读了这篇文章http://www.atwix.com/magento/reset-admin-password-mysql/但它对我不起作用。或者可能是我没有得到这个

请帮助我是 Magento 的初学者

4

15 回答 15

31

去 :

1 - 登录到 PhpMyadmin 。

2 - 跳转到 Magento 的数据库。

3 - 转到 admin_user 表并编辑该表。

4 - 输入“密码”(您想要的)并从功能下拉列表中选择 MD5(重要)。

这适用于 CE 和 EE 最新版本(在两个最新版本中都经过测试),无需更改核心文件。

于 2013-06-07T11:49:27.790 回答
21

这将被证明是一个很好的阅读资源:http: //www.magentocommerce.com/wiki/recover/resetting-admin-password

SELECT * FROM admin_user;

然后,在提供的列表中找到您要修改的用户名——本例中为“admin”。然后,要更新密码,请键入:

UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';

'qX' 将更改为您想要的任何内容,'password' 也是如此</p>

于 2013-06-07T11:44:35.850 回答
10

Mostly, when we install the Magento Community on our local computer (XAMPP, WAMPP), it looks like we can't log in as the administrator from the backend. The system will prompt us we input the wrong password, but it's not the truth.

When i come up with this issue, i tried to reset the password by following method (in SQLyog).

UPDATE admin_user 
SET password=CONCAT(MD5('qXpassword'), ':qX') 
WHERE username='admin';

‘password’ should be set to whatever you want for your new password, and ‘qX’ would be any random characters you like.

But we still can not log in. At first, I thought this method is wrong method. While, the 'admin' password definitely had been changed. But why we still can not log in?

Maybe we have input the right user name and password, but we still can't log in.

Use Notepad ++ to open and edit core file: app/code/core/Mage/Core/Model/Session/Abstract/Varien.php, within your magento directory and comment those below lines:

$cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath() //,
            // 'domain'   => $cookie->getConfigDomain(),
            // 'secure'   => $cookie->isSecure(),
            // 'httponly' => $cookie->getHttponly()
        );

And try again, you should can log in as admin from the backend.

The problem is Localhost or "127.0.0.1" are not true domains, and browsers allow only real domains to store cookies, that's why login stops and with invalid Username or Password.

于 2014-08-04T03:16:44.203 回答
7

我通常这样做的方式如下:

在 login.phtml 模板中的某处添加此代码段app/design/adminhtml/default/default/template/login.phtml

Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$user = Mage::getModel('admin/user')->loadByUsername('YOUR_USERNAME');
$session = Mage::getSingleton('admin/session');
$session->setUser($user);

将“YOUR_USERNAME”替换为您的管理员用户名。转到登录页面(yourdomain.com/admin),现在您的管理会话已设置。当您再次进入登录页面时,您应该会自动登录。现在您可以在 中重置您的密码system > permissions > users

登录后不要忘记从模板中删除代码段。

这可能不是最好的答案,但它一直对我有用。

于 2013-06-07T20:41:05.263 回答
5

Poking around in the database is a horrible idea, when you've got an entire framework at your fingertips. This is the proper way of changing the admin password:

Create a file called reset-password.php and place it in the site root:

<?php

chdir(dirname(__FILE__));
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);

$user = Mage::getModel('admin/user')
    ->load('admin', 'username')
    ->setNewPassword('mynewpassword')
    ->save();

Make a request for /reset-password.php in your browser, and the Magento framework should update the password for admin to mynewpassword.

于 2014-11-24T09:26:19.643 回答
4

This solution work for all versions of Magento.

Add temporally this at end of index.php

$user = Mage::getModel('admin/user')->loadByUsername('your_username');
$user->setPassword('new_password');
$user->save();

And your new_password was saved. Now remove 3 lines at the end of index.php.

Have a nice day.

于 2015-08-19T08:47:08.053 回答
2

如果您有权访问 phpMyAdmin,以下是重置密码的步骤。

首先,打开 phpMyAdmin。从左侧边栏中单击 Magento 的数据库名称。单击 SQL 选项卡并在文本框中键入以下内容:

UPDATE `admin_user` SET `password` = MD5('PASSWORD') WHERE `username` = 'USERNAME';

您需要用正确的信息替换大写的值:

USERNAME - 您将要更新其密码的用户 PASSWORD - 您要使用的新密码 例如,如果我的用户名是 admin 并且我想将密码重置为 123456,我会这样做:

UPDATE `admin_user` SET `password` = MD5('123456') WHERE `username` = 'admin';

如果您不知道要更新的用户的名称,您可以通过单击侧栏中的 admin_user 链接查看所有用户,然后选择“浏览”选项卡。用户名列包含可用用户的列表。

于 2014-02-17T08:52:11.170 回答
2

To reset your admin password, you have to create a file and paste the bellow code into this file and upload it in your magento root directory.

<?php
require_once 'app/Mage.php';
umask(0);
/* not Mage::run(); */
Mage::app('default');

## For magento1.7 or Earlier var
//$_HASH_SALT_LENGTH = 2;
## For magento1.8 and magento1.9
$_HASH_SALT_LENGTH = 32;

#Generate admin password
$password = "admin1234";
echo $adminPass = Mage::helper('core')->getHash($password, $_HASH_SALT_LENGTH);
## And reset password field in "admin_user" table

?>

And that’s it, now you are able to login from admin using by this given password.

For detail about reset admin password, Please go to my blog link http://www.scriptlodge.com/how-to-reset-admin-password-in-magento/

于 2014-06-08T15:23:24.117 回答
1

3 Steps without MySql

To login into magento admin, using only ftp access is a little tricky.

Step 1 :

open the class Mage_Admin_Model_User located at app\code\core\Mage\Admin\Model\User.php.

Step 2 :

Next find the authenticate() function around line no: 225. Inside the authenticate function, this code is written,

$this->loadByUsername($username);

You need to add the line return true; after this,

$this->loadByUsername($username);
return true;

Step 3 :

And that’s it, now you login in admin using any password. Since, we have skipped the code for password checking, login using any password and then change the password in admin from

System -> Permission -> Users.

于 2014-08-08T08:05:53.483 回答
0

打开 phpMyAdmin 并在打开您的数据库下找到表“admin_user”并在该表中找到您的用户名。删除那里的密码并为您的新密码创建一个新的 MD5 哈希并将其放在那里。

于 2013-06-07T11:46:49.140 回答
0
<?php
$pass = "12345678";
  $salt = "EI";
  echo md5($salt.$pass).":".$salt;
?>
Update 'admin_user' table password field with the output of above program.

Follow below link for more information...
[http://www.atwix.com/magento/reset-admin-password-mysql][1]
于 2013-10-23T16:51:57.140 回答
0

按照以下步骤重置 Magento 用户密码:

1) 登录到 PhpMyAdmin。

2)打开 Magento 数据库。

3)如果您在安装 Magento 时未设置任何表前缀,则现在打开“ admin_user ”表,或者如果您设置了表前缀,则打开“ prefixadmin_user ”表。

4)现在在用户密码字段中,您可以看到MD5 哈希转换的密码。因此,首先您需要将纯文本转换为 MD5 哈希格式,然后复制 MD5 Hast 格式密码并将其粘贴到“ prefixadmin_user ”数据库表下的用户密码字段中。

于 2013-10-26T10:39:07.793 回答
0

$date = new DateTime();

$password = "b919ec4a25be3bc46c00895a0eb4f907:c20ad4d76fe97759aa27a0c99bff6710";

$sql = "更新yourmagentoDB. admin_userSET password= \'".password."\', rp_token_created_at= ". $date->getTimestamp() ." WHERE admin_user. user_id= ".$user_id;

例如,您的密码是:frank123。想想任何至少有两位的字符串。就我而言,我将把我的新密码设为“frank123”,将盐设为“MD5(12)”。接下来转到任何 md5 生成器站点并生成字符串“c20ad4d76fe97759aa27a0c99bff6710frank123”的 md5。在我的例子中,md5 是“b919ec4a25be3bc46c00895a0eb4f907”。现在,使用上述脚本编辑表格行。

请参阅下面的如何使用 FTP

http://excellencemagentoblog.com/how-to-reset-magento-admin-passwor

于 2014-02-06T00:57:53.357 回答
0
于 2014-04-06T05:26:16.427 回答
0

The cleanest way to fix this issue is to reset the Magento installation; be sure you keep details of your database credentials in a safe place:

  1. Delete local.xml in app\etc
  2. Delete \var\cache content
  3. Delete \var\session content
  4. Run the installation script in the browser with http://yourdomain/index.php
  5. Run the first screen (Localization)
  6. In the second screen, enable "Skip Base URL Validation Before the Next Step"
  7. Clean browser cache and cookies

Works 100% of the times.

于 2015-06-20T15:12:02.763 回答