问题
after installing magento in my local machine I forgot admin password what I have given. I am not able to login to my admin area how can I reset the password
I have read this article http://www.atwix.com/magento/reset-admin-password-mysql/ but it is not working for me. Or may be I am not getting this
please help me am a beginner of Magento
回答1:
Go To :
1 - Login in to PhpMyadmin .
2 - Jump in to Magento's database .
3 - Go to admin_user table and edit the table .
4 - put a "password" (which you want) and select MD5 from function dropdown (Important).
This is working both in CE And EE latest version (tested in both latest version), no need of core file changes.
回答2:
This would prove to be a good resource to read: http://www.magentocommerce.com/wiki/recover/resetting-admin-password
SELECT * FROM admin_user;
Then, find the username you want to modify in the listing provided - ‘admin’ in this example. Then, to update the password, type:
UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';
‘qX’ would be changed to whatever you want it to be and same goes for ‘password’
回答3:
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.
回答4:
The way I usually do it is as follows:
Add this snippet somewhere in your login.phtml template 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);
Replace 'YOUR_USERNAME' with your admin user name.
Go to the login page (yourdomain.com/admin), now your admin session has been set.
When you go to the login page again, you should be automatically logged in. Now you can reset your password in system > permissions > users
.
Don't forget to remove the snippet from your template once your are logged in.
It might not be the best answer but it has always worked for me.
回答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
.
回答6:
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.
回答7:
If you have access to phpMyAdmin, here are the steps to reset your password.
First, open up phpMyAdmin. Click on your database name for Magento from the sidebar on the left. Click on the SQL tab and type the following in to the text box:
UPDATE `admin_user` SET `password` = MD5('PASSWORD') WHERE `username` = 'USERNAME';
You’ll want to replace the capitalized values with the correct information:
USERNAME - The user whose password you’ll be udpating PASSWORD - The new password you want to use For example, if my username was admin and I wanted to reset the password to 123456, I would do this:
UPDATE `admin_user` SET `password` = MD5('123456') WHERE `username` = 'admin';
If you don’t know the name of the user you want to update, you can see all the users by clicking on the admin_user link from the sidebar, and then select the Browse tab. The username column has the list of available users.
回答8:
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/
回答9:
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.
回答10:
Open phpMyAdmin and under open your database and under that find table "admin_user" and find your username in that table. Delete the password over there and create a new MD5 hash of your new password and place it there.
回答11:
<?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]
回答12:
$date = new DateTime();
$password = "b919ec4a25be3bc46c00895a0eb4f907:c20ad4d76fe97759aa27a0c99bff6710";
$sql = "UPDATE yourmagentoDB
.admin_user
SET password
= \'".password."\', rp_token_created_at
= ". $date->getTimestamp() ." WHERE admin_user
.user_id
= ".$user_id;
For example, your password is: frank123. Think of of any string of at least two bits. In my case i will take my new password to be “frank123” and salt to be “MD5(12)”. Next go to any md5 generator site and generate md5 of string “c20ad4d76fe97759aa27a0c99bff6710frank123”. The md5 in my case being “b919ec4a25be3bc46c00895a0eb4f907″. Now, edit the table row with the above script.
see how to use FTP below
http://excellencemagentoblog.com/how-to-reset-magento-admin-passwor
回答13:
Follow the below procedure to reset Magento User Password:
1) Login to PhpMyAdmin.
2)Open Magento Database.
3)Now open "admin_user" table if you not set any table prefix at the time installing Magento, Or if you set table prefix then open "prefixadmin_user" Table.
4)Now in User password field you can see MD5 Hash converted password. So first you need to convert your plain text into MD5 Hash format and after that copy the MD5 Hast format password and paste it in User Password field under "prefixadmin_user" database table.
回答14:
Get List of Users:
*Note: Add your table prefix before table name.
SELECT * FROM admin_user;
Then, find the username you want to modify in the listing provided - ‘admin’ in this example. Then, to update the password, type:
UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';
‘qX’ would be changed to whatever you want it to be and same goes for ‘password’
You can also do this in phpMyAdmin, find the admin_user field and choose MD5 when updating password.
If you want to add a new admin user, you must not only create a new entry in the table ‘admin_user’, but you also have to insert an entry in the table ‘admin_role’ which has to be associated with the user by the field ‘user_id’.
回答15:
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:
- Delete local.xml in app\etc
- Delete \var\cache content
- Delete \var\session content
- Run the installation script in the browser with http://yourdomain/index.php
- Run the first screen (Localization)
- In the second screen, enable "Skip Base URL Validation Before the Next Step"
- Clean browser cache and cookies
Works 100% of the times.
来源:https://stackoverflow.com/questions/16983227/after-installing-magento-in-my-local-machine-i-forgot-admin-password